BUG: Make write of binary file compatible with Python 3.

Open the destination file with the byte flag to avoid error in
Python 3 with mismatch of str and byte.