Can the bank write in the banking contract that 'closing the account' does not actually close it?
Yes, it can and it explicitly does.
That question does not indicate which bank they were doing business with but here is what Chase Bank has to say. Make sure to take note of the closing statement.
VIII. Closing Your Account
Either you or we may close your account (other than a CD) at any time for any reason or no reason without prior notice. We are not required to close your account at your request if you have pending transactions, the account is overdrawn, your account is subject to legal process (such as a garnishment, attachment, execution or levy) or any type of holds (such as collateral hold, decedent hold or deposit hold). In those cases, we will limit the types of transactions that you can make until pending transactions are paid or returned, the balance is no longer negative and any legal restriction/hold has been released. After we restrict your account in preparation for closing, we will not pay any additional interest on the account. We may automatically close your account if the balance is $0 or negative. Either you or we may close your CD account on any maturity date without cause.
We may send you written notice that we have closed or will close your account and return the balance less any fees, claims, setoffs or other amounts if the balance is greater than $1. After your account is closed, we have no obligation to accept deposits or pay any outstanding checks, but we may reopen your account if we receive a deposit. We will have no liability for refusing to honor any check drawn on a closed account. We may advise consumer reporting agencies of accounts closed for misuse, such as overdrafts.
This agreement continues to apply to your account and issues related to your account even after it closes.
https://www.chase.com/content/dam/chasecom/en/checking/documents/deposit_account_agreement.pdf
Here is some of their auto-payment legalese:
Cancellation/Termination: Chase can terminate this Agreement at any time with notice. You may cancel this authorization at any time by notifying Chase at least three business days prior to the date that you’d like the cancellation to be effective. You can cancel by secure email message on chase.com or using the payment page online; or by U.S. mail at Chase Auto, PO Box 901063, Fort Worth, TX 76101-2063. You can also call us to cancel or to ask questions at 1-800336-6675 for loan accounts or 1-800-227-5151 for lease accounts.
https://www.chase.com/content/dam/chase-ux/documents/personal/auto-loans/caf_form.pdf
Overall, it sounds like one hand doesn't care what the other is doing. I would assume the checking department is different than the auto-pay department.
Could Chase Bank have a better customer service experience? Certainly. Maybe a better agent would have spotted the auto-pay when closing the account.
Who is in the right here?
Based on the contract agreement, I would say the bank is. Ignorance does not absolve the account holder of responsibility.