Fix Error opening file for writing on Windows 10