[fix] Capture the IP address before the connection closes.