This depends on the jurisdiction, but such companies are typically subject to regulations (and audits) that require them to keep the customers' accumulated premiums very strictly separated from the company's own assets, liabilities and expenses. Additionally, they are typically only allowed to invest the capital in very safe things like government bonds.
So, unless something truly catastrophic happens (like the US government defaulting on its bonds) or people in the company break the regulations (which would invovle all kinds of serious crimes and require complicity or complete failure of the auditors), your premiums and the contractual obligation to you would still be there, and would be absorbed by a different insurance company that takes over the defunct company's business.
Realistically, what all this means is that insurance companies never go bankrupt; if they do badly, they are typically bought up by a competitor long before things get that bad.