Open files in binary mode where appropriate