title: Generating multiple pdfs with TCPDF and saving in a zip outputs a corrupted zip file
body: <p>I generate PDFs with a loop using TCPDF, the PDFs are created perfectly fine with no errors. I am using wamp server, so the files are stored in C:\wamp64\tmp, now I am trying to add the generated files in a zip.</p>
  
  <p>This is the code I have. I ignored the content of the pdf to save space, as I mentioned the PDF creation works fine.</p>
  
  <pre><code>&lt;?php
  //$tmp is the path of temp folder C:\wamp64\tmp
  $tmp = ini_get('upload_tmp_dir');
  
  //The number of files that will be created
  $num_contactos = sizeof($contactos);
  
  $file = $tmp.'/my-pdf.zip';
  $zip = new ZipArchive();
  $zip-&gt;open($file, ZipArchive::OVERWRITE);
  
  for ($i = 0; $i &lt; $num_contactos; $i++) {
  
      // create new PDF document
      $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
  
      // add a page
      $pdf-&gt;AddPage();
  
      $html = 'PAGE CONTENT';
  
      // set core font
      $pdf-&gt;SetFont('helvetica', '', 10);
  
      // output the HTML content
      $pdf-&gt;writeHTML($html, true, 0, true, true);
  
      // reset pointer to the last page
      $pdf-&gt;lastPage();
  
      //PDF file is created in temp folder. This works fine.
      $pdf-&gt;Output($tmp.'/POG - '.$i.'.pdf', 'F');
  
      // ADD PDF FILE TO ZIP
      $zip-&gt;addFile($tmp.'/POG - '.$i.'.pdf', 'POG - '.$i.'.pdf');
  }
  //After I loop ends, I close the zip file and force download
  $zip-&gt;close();
  header('Content-type: application/zip');
  header('Content-Disposition: attachment; filename="my-pdf.zip"');
  readfile('my-pdf.zip');
  ?&gt;
  </code></pre>
  
  <p>The zip file downloads but I cannot open it because it is damaged. What could be causing this issue?</p>