Open private key file in binary mode when writing

Prevent newlines from being converted to CRLF when writing private key
to file.