cleanup socks library. Add on_close callback to session