This release handling for when the connection silently drops, like in the case of internet connection drop. We send a ping message and a new timeout will wait 5 seconds for a response before closing the connection.
Also included is a small fix to clear timeouts when the disconnect
function is called as their can be quite a delay before the close
handler is called and we don't want to send any more messages (ping) during that time.