Many Debtors ask Bankruptcy attorneys if they can keep a card through their bankruptcy case. They often propose to omit listing a particular card from their schedules or propose to pay off a card before filing so that the card will not have to be listed as a liability in their bankruptcy case.
20 years ago, when credit reporting was less sophisticated and more isolated, as long as you did not create a voidable preference by paying too much too soon on a credit card, there was a good chance you could keep a card you did not have to list. Since 1978, a Debtor in Bankruptcy has had to list all liabilities whether they wanted to reaffirm the debt and keep paying or not. So, that strategy has been a non-starter for decades.
Credit card companies are not required by the law to suspend or close your accounts merely because you file for Bankruptcy, but most do. The reason is that when you file for Bankruptcy unless you specifically assume a contract it is usually discharged in a Bankruptcy. This means that the credit card company no longer has a contract with you. Of course, the very next time that you use your credit card and sign a charge slip you have entered into a brand new contract with the card issuer, but most banks and credit card issuers like a higher degree of formality. There is an interesting argument that the card issuer for an account that is not delinquent cannot discriminate against the debtor simply because of the bankruptcy filing, but it is rarely useful in real world application.
So, people who file for Bankruptcy must be prepared for the fact that most credit card companies will learn of the Bankruptcy and most credit card companies will close your account. This is why paying credit cards down, or paying them off, prior to filing usually has no actual advantage to be gained in the vast majority of cases.