Error opening file for writing on Windows 11/10