diff --git a/SourceX/miniwin/misc_io.cpp b/SourceX/miniwin/misc_io.cpp index a7e6facf8..00b811815 100644 --- a/SourceX/miniwin/misc_io.cpp +++ b/SourceX/miniwin/misc_io.cpp @@ -138,6 +138,7 @@ WINBOOL CloseHandle(HANDLE hObject) filestream.write(file->buf.data(), file->buf.size()); if (filestream.fail()) throw std::runtime_error("ofstream::write"); + filestream.close(); std::remove(file->path.c_str()); if (std::rename((file->path + ".tmp").c_str(), file->path.c_str())) throw std::runtime_error("rename");