open files in binary mode to fix problems on windows