Fix file handles being left open on windows builds

This should fix the issue of unable to save over an existing save on windows.  Tested with 32bit and 64bit builds, Debug and Release.