Fixing the program for windows by explicitly setting file encoding on write