code: private void closeRemainingSessions()
      {
          if (sessions == null)
              return;
          
          List<AbstractSession> sessionsToClose = new ArrayList<>(sessions.size());
          synchronized (sessions)
          {
              sessionsToClose.addAll(sessions.values());
          }
          for (int n = 0 ; n < sessionsToClose.size() ; n++)
          {
              Session session = sessionsToClose.get(n);
              log.debug("Auto-closing unclosed session : "+session);
              try
              {
                  session.close();
              }
              catch (JMSException e)
              {
                  ErrorTools.log(e, log);
              }
          }
      }
docs: Close remaining sessions