Revert "Don't open/close file for every file operation." as it was crashing PokePark in Windows builds. This reverts commit efcb2abe9bf60978d2e5e776268179671bfef87a. Fixes issue 6098.