Earlier quoted context omitted.
> Now you're in a position where you sold $5 Billion worth of shares on a company that (by all fair evaluations) is only worth $1 Billion after the capital raise. That's entirely reasonable if you think that by keeping the company alive you can build it back up until the point that it's worth more than $5B. This is indeed what every CEO thinks -- that they can make the company worth more next year than it's worth thi…
Hertz agreed to bankruptcy, so that they don't have to pay all of their debts anymore. That's... literally what's going on. As part of the bankruptcy proceedings, shareholders usually get wiped out. They wouldn't have pushed this button unless they believed that their bonds were hopelessly unpayable.
In addition to the court finding that a bankruptcy is no longer appropriate, either the debtor or the creditor can petition the court to dismiss a bankruptcy. This is not entirely uncommon, even when a company might have more liabilities than assets, when creditors believe their interests are harmed more by bankruptcy than a less drastic measure. This avoids companies declaring bankruptcy out of convenience rather than necessity. Shareholders are themselves creditors, and so they too could petition the court to dismiss a bankruptcy under such circumstances.
Finally, while companies (mostly) won't enter bankruptcy if they see other options, bankruptcies do not automatically wipe out shareholders, though that is probably the more common outcome. It is possible however to retain your shares, which would usually be exchanged (possibly at a discount) for shares in the newly constituted company post-bankruptcy.