Fix SSL socket error handling.

Update IOLoop event handler on SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE.
Update event_state flags only if SSLError does not occur.
Check for self.socket to ignore events on closed socket.

Remove unused variable self.fd
Define object attributes in constructor.

This prevents current and potential future KeyErrors.
Initialise connection state variables before connection attempt.

Cleanup during shutdown is less reliable if exception is thrown.