HSA contributions while on medicare

My husband went on medicare in 2022.  In 2023 we started a HSA with pretax payroll deductions.  I did not discover until last fall, that you could not make contributions to a HSA if on Medicare.  We had already done a distribution of some of money.  I had the 2024 contributions withdrawn as incorrect contribution and am amending my taxes for that year, to show as income.  There is less than the amount of 2023 left in the HSA due to the distribution we used in 2024 to pay my medicare premium.  Can I just use the balance to pay my husbands medicare premium now and the balance will be zero and would close the HSA. Then how do I amend taxes for 2023?  Do I just put in a form showing the distributions were made from improper contributions and there'd be a form to show it as taxable income? I know there would be a penalty involved, 6% I believe.