fix file write error on windows