To answer this question, I visited the HDFC Bank to close my bank account and asked them what will happen if a payment is made to the account I am closing, and they had to say this.
If the amount is credited just after the account’s closure (less than a month or so), the bank will send a cheque for the said amount to the registered address with the bank.
After a specific interval, the bank rejects the incoming credits to a closed account.
Depending on when you close the account, your amount will either get credited, and you will get a check for the same, or the refund will be rejected.
If the refund gets rejected, you have to get in touch with the sender and ask them to refund again to a different source.