Fixed several memory leaks on deinit of OpenSSL