Open files in binary mode. Closes #3948