Fixed save_to_file for PrivateKey objects