Fix memory leaks appearing when cvOpenFileStorage throws

I'm not sure why a C function throws in the first place, but changing that would probably be too backwards-incompatible (not to mention time-consuming).