code: private function closeOpenGroups()
      {
          $this->data['groupPriorityStack'][] = 'main';
          while ($this->data['groupPriorityStack']) {
              $priority = \array_pop($this->data['groupPriorityStack']);
              foreach ($this->data['groupStacks'][$priority] as $i => $info) {
                  if ($info['collect']) {
                      unset($this->data['groupStacks'][$priority][$i]);
                      $meta = array(
                          'channel' => $info['channel'],
                      );
                      if ($priority === 'main') {
                          $this->data['log'][] = array('groupEnd', array(), $meta);
                      } else {
                          $this->data['logSummary'][$priority][] = array('groupEnd', array(), $meta);
                      }
                  }
              }
          }
      }
docs: Close any unclosed groups
  
  We may have forgotten to end a group or the script may have exited
  
  @return void