Closing an account does not automatically cancel any associated debt or credit card.
Settle your card balance and any outstanding installments/transactions, and then ask your bank to close the card first, followed by the account, in the correct order.