Callback for when the connection is closed for any reason.
This should be invoked when close() is called as well.