Handle closed irc socket

Free sessions upon quit, and avoid infinite loop with closed session