When you file for bankruptcy in the U.S., all lawsuits against you are put on hold pending the outcome of the bankruptcy case, and the bankruptcy court acquires full power to decide all claims against you, including wiping out debts you owe. The bankruptcy court’s first priority is the payment of all just creditors with as many cents on the dollar as possible, so bankruptcy cases often result in the sale of property owned by the debtor. The bankruptcy court has full power over all income of the debtor and can actually direct the debtor on how to spend money (I’m taking away your credit cards and selling your second car; now stop buying steaks and going to movies until I say otherwise). This continues until the bankruptcy court has done everything it can to pay off the creditors; then it discharges (wipes out) all remaining debt and closes the case, leaving the debtor free to start over.
In the case of a religious institution like a Catholic diocese, this means for example that all sexual abuse lawsuits are on hold until the bankruptcy court either takes over the lawsuits (meaning the trials occur before the bankruptcy judge), allows the cases to proceed in the original courts, or simply dismisses the claims. It also means that the bankruptcy court can inspect the diocese’s finances and give orders about how the money is to be spent.
There are certain restrictions because of the First Amendment, but they’re very limited. The bankruptcy court can’t interfere with the exercise of religion; but, when you get right down to it, the exercise of religion does not actually require a whole lot of money (if we don’t have a church building, we’ll meet somewhere else; if necessary, the diocese can close its seminary and send seminarians to another diocese’s seminary; etc.). So the bankruptcy court can direct the sale of property and how the proceeds are to be used, even if the property being sold happens to be a cathedral or what have you.
Eventually, though, the bankruptcy process ends, and all remaining debts are discharged. At that point, the diocese is back where it began, free of debt (except debt that the bankruptcy court allows to remain – a classic example is mortgages if the debtor has the funds to pay), with all claims resolved.
How long that takes depends on the complexity of the bankruptcy, the size of the insolvency (debts minus assets), and the length of any appeals by anyone involved.