It is entirely reasonable for there to be dire financial straits that require layoffs, yet when a $10 billion investment suddenly blows up and has to be saved the money can be spent to fix it.
In the first case it wasn't that there was no cash in the bank and no bank willing to make loans, but that the company needed to spend less than it earned in order to make a profit. In the second case it wasn't that the money had been hidden in a mattress, but that it was raised/freed-up at some risk which was necessary because of the $10 billion investment.