Prevent closing the wrong connection

In the event of an SSL error (eg, bad certificate from a client), `client` here still pointed to the last successful connection.
So when a client failed to connect, and `client` still pointed to the last successful connection, we were forcing that good connection to be closed.

This PR sets `client` to `nil`, before accepting a new connection, and then tests to make sure it's not `nil`, before closing it.