Synchronize closing the OpenSSL wrapper and the underlying socket