Added session.close() to cleanup sockets