Handle tcp_closed in the connection process
Fix indentation