Fixes bug where file not opened in binary mode.