handle tcp connection close