Securely close SSL connection by standard SSL_shutdown

For SSL in close_connection, current implementation use close_socket_gracefully to close socket firstly, then SSL_free. In my testing, this approach may cause some pending write data missing. 

I'd suggest use standard SSL_shutdown in SSL conection. It need call twice according to openSSL manual - one call sends the close_notify alert and one call receives the response from the peer

This patch fix issue #168