Because you became aware of the mistaken distribution in 2017, you have until April 15, 2018 (not the due date of your 2017tax return) to return the mistaken distribution to an HSA. Otherwise, unless there are other qualified medical expenses incurred after you established the HSA account (but perhaps before the end of 2016; the guidance is not clear as to whether a distribution from an HSA can be applied to a qualified medical expense incurred after the distribution is made, although there is nothing in the statute or existing guidance that appears to explicitly prohibit doing so) to which you can apply the amount of the mistaken distribution, you must amend your 2016 tax return to change the amount that you claimed as having been applied to qualified medical expenses. This will result in the amount of the mistaken distribution being reported as miscellaneous income on 2016 Form 1040 line 21 and will cause the 20% early-distribution penalty (if you were under age 65 at the time of the distribution) to be calculated on 2016 Form 8889 line 17b which transfers to 2016 Form 1040 line 62.
Regarding making a return of mistaken distribution, you can check to see if your old HSA account can be reopened. However, if the account can be reopened and they will accept the return of mistaken distribution, they are supposed to issue a corrected 2016 From 1099-R to reduce by the amount returned the amount of distributions previously reported. The HSA custodian is not required to accept a return of mistaken distribution, so, given that the account is presently closed and they would have to go to the effort of issuing a corrected Form 1099-R for one that was issued a year ago, they may be reluctant to accept the return of mistaken distribution.
Q–26. What are the “qualified medical expenses” that are eligible for tax-free distributions?
A–26. The term “qualified medical expenses” are expenses paid by the account beneficiary, his or her spouse or dependents for medical care as defined in section 213(d) (including nonprescription drugs as described in Rev. Rul. 2003–102, 2003–38 I.R.B. 559), but only to the extent the expenses are not covered by insurance or otherwise. The qualified medical expenses must be incurred only after the HSA has been established. For purposes of determining the itemized deduction for medical expenses, medical expenses paid or reimbursed by distributions from an HSA are not treated as expenses paid for medical care under section 213.
This does not seem to preclude applying an HSA distribution to a future medical expense as long as the expense was incurred after the HSA account was established and as long as you have sufficient documentation to show that the distribution was applied to a qualified medical expense. However, such an interpretation would be subject to abuse where one could take a tax free distribution from the HSA and use the money for any purpose as long as they *eventually* incur a medical expense to which the distribution can be applied, even years down the road, and would make it impossible to enforce the early-distribution penalty. On the other hand, the instructions for Form 8889 say to include on line 15 those expenses that *were* used for qualified medical expenses, which suggests to me that one should not include expenses incurred after the end of the year of the tax return. As far as I know, though, the IRS is not in the habit of policing the application of HSA distributions to qualified medical expenses.