Open files in binary mode. Closes #3948
auto merge of #8298 : darkf/rust/fix-3948, r=pcwalton