But my question is what happens if the insurance company goes out of business mid-treatment?
If you cared to find that out, there are numerous examples out there right now. Companies go out of business, merge, change the terms of a plan (at renewal), etc., all the time. Providers change their participation in networks as well.
Usually the provider is left holding the bag.
Consider a third party administrator that acts as the facilitator for several insurance companies. It guarantees payment, it provides authorization and staffing services, and it negotiates contracts. Now consider that it goes out of business.
Several things start to happen.
The first is that some notice has to be given by the insurance company (or third party administrator) to the providers. Unfortunately, this notice doesn't have to be particularly long and since the company's going out of business it doesn't have much to fear.
The second is that patients will have to find someplace that directly accepts their insurance. This might be the same provider. It might not. Reasonable efforts have to be made not to interrupt care; there is no coldhearted turning off someone's IV because they cannot pay. That would be exceptionally bad for business even if it were no longer illegal.
The third is that the provider will try to work directly with the insurance company to make all debts whole. This is going to fail, but the degree to which it fails varies. In instances where the provider didn't used to take the insurance directly (hence the need for a third party administrator), it can sometimes lead to direct contracts that benefit both parties. Most of the time it's going to wind up reminding the provider why they didn't want to take XYZ Insurance directly to start with.
There might also be lawsuits involved to get the insurer or third party administrator to pay out, but good luck with that. By the time a health insurer is going belly up, there's not much to confiscate.
The long and short of it is that lifesaving care continues, other insurers will likely be willing to provide similar coverage at a similar rate, and providers get a much shorter end of that stick than the patients.