IRS finalizes rules on eligible terminated S corporations