Accounts payables when company sell all assets?

So what happens to the AP and Debt when the company sells its business via an asset sale? Do they just declare bankruptcy and the AP / debt is written off? (Assuming there’s no convenants or personal guarantee on the debt).