emit close event when tick detects the socket is closed