title: Why does Apache poi's Workbook.close() method write content to input file?
body: <p>Apache poi's documentation (version 3.17) says</p>
  <blockquote>
  <p>void close()</p>
  <p>throws java.io.IOException</p>
  <p>Close the underlying input resource (File or Stream), from which the Workbook was read.</p>
  </blockquote>
  <p>My code creates a workbook from a template file, does something with it and writes it to a new file. The template file should be left unchanged. But when I call the close() method, the file is changed in the same way as the output file.</p>
  <p>Can someone explain this? Is there something like a built-in write() call in the close() method? Is this a bug or a feature?</p>
  <p>My solution so far is to just leave away the close() call, but it feels incomplete somehow.</p>
  <pre><code>    String inPath = &quot;/home/elmicha/test/template.xlsx&quot;;
      String outPath = &quot;/home/elmicha/test/out.xlsx&quot;;
  
      try {
          Workbook xlsxFile = WorkbookFactory.create(new File(inPath));
  
          xlsxFile.getSheetAt(0).createRow(0).createCell(0).setCellValue(&quot;test&quot;);
  
          try (FileOutputStream pOuts = new FileOutputStream(outPath)) {
              xlsxFile.write(pOuts);
              
          xlsxFile.close();
          
          }
  
      } catch (IOException | InvalidFormatException | EncryptedDocumentException ex) {
          //...
      }
  </code></pre>