Filing does not stop the business; it stops the creditors. Management typically stays in control as debtor in possession, an automatic stay halts collection, and the company negotiates a plan-of-reorganization that says who owns the company afterwards. Distribution follows the absolute-priority-rule, so common equity is last.
The stock keeps trading, usually delisting to the over-the-counter market with a bankruptcy-ticker-suffix, and it routinely rallies on procedural headlines even when the plan on file gives common holders nothing. The plan document, not the price action, is where the answer is.
Example: a company owes $2.1B and the enterprise is valued at $1.4B in the plan. Unsecured creditors recover 67 cents and receive all the new equity. Old common receives nothing, though it traded at $0.31 the week before confirmation.
Related: chapter-7, absolute-priority-rule, plan-of-reorganization, post-reorganization-equity, equity-committee