Fix file corruption on Windows

MBTiles ends up with corrupted image data if built from cache on Windows