Actually it didn't.
Film studios regularly produce a number of flops every year - INTENTIONALLY. They're tax right-offs that lower their tax bracket, so the failure ends up being an overall net gain for the company.
Add to that, after-markets like anti mentioned, they can still get some money out of them, as well as fluff out their catalog.