mail_close_socket() also destroy the session, and take pointers to set the socket to INVALID_SOCKET, and the session to -1.