Had we simply allowed them to go bankrupt, it would've nullified the bonus contracts (along with all other wage contracts), and they wouldn't have had to pay it.
However, the government gave them bailout cash, so there wasn't really any legal way to avoid paying their contractual wages.