(PUP-1840) Use binary mode for files

Understanding the checksums for files requires that we are very careful about
how data is written and read. This is to avoid having a windows system
translate line endings and causing the data on disk to be different from what
the tests expect.