Fix open mode. 'w' => 'wb'