Yes, it could be legal. Of course much depends on the language of the contract you signed regarding the closed restaurant. The contract determines the nature of the promises made on each side, and how the contract is terminated and/or completed. The contract may or may not have provisions providing for what happens in the event the business closes or it may have termination provisions. You need to review the terms of the contract to see if there are any such provisions upon which you can rely.
If there is no specific terms in the contract upon which you can rely, there is one alternative which may work. You can decide not the pay the monthly fee, and then the credit card merchant would have to sue you for breach on contract. In defending this breach of contract
lawsuit, you could argue that an implied
term or condition of the contract was that the monthly fee would cease once you stopped using their services. Occasionally, a court will read into a contract certain implied terms of a contract in order to carry out the intent of the parties. Of course a contract can not cover every conceivable situation that might occur during the performance a contract. And so, if a contract is silent on a particular issue, the court may imply certain agreements were made between the parties.
So, I would actually present this argument to the credit card company first - that it was an implied agreement of the contract that monthly fees would terminate if you went out of business - and see if they persist in seeking the fees. Then if they do persist and you decide not to pay, you can try this defense in a breach of contract lawsuit.