(#9983) Restore files in binary mode
Previously we were restoring files in text mode, which causes Windows
to translate '\n' characters into '\r\n', thereby corrupting the file.
It also incorrectly computed the checksum for the to-be-restored file
for the same reason.
This commit sets the binary mode flag in both cases, which is a noop
on Unix.