Fix atomic writes on windows.