Update fopen calls for Windows compatibility

Open files in binary mode, or on Windows fread/fwrite will treat the files as text and mangle the read/written data
3 jobs for master in 1 minute and 7 seconds (queued for 2 seconds)
Status Name Job ID Coverage
  Build
passed build-debian #802
debian amd64

00:00:22

passed build-win32 #803
win32

00:00:21

passed build-win64 #804
win64

00:00:23