code: public function disconnectWorksheets()
      {
          $worksheet = null;
          foreach ($this->workSheetCollection as $k => &$worksheet) {
              $worksheet->disconnectCells();
              $this->workSheetCollection[$k] = null;
          }
          unset($worksheet);
          $this->workSheetCollection = [];
      }
docs: Disconnect all worksheets from this PhpSpreadsheet workbook object,
  typically so that the PhpSpreadsheet object can be unset.