title: Java nio2 Directory is not closed. Causes "too many open files" error
body: <p>I am creating a lot of temp directories for batch processing using this:</p>
  
  <pre><code>Path tmp = Files.createTempDirectory("tmp-images");
  </code></pre>
  
  <p>The directory may contain 1-50 image files. I am deleting the directory after processing using Apache <code>FileUtils</code>:</p>
  
  <pre><code>FileUtils.deleteDirectory(tmp.toFile());
  </code></pre>
  
  <p>The directory is deleted but I am running into "too many open files". <code>lsof</code> is giving me this:</p>
  
  <pre><code>java    DIR  253,0   6  136899239 /opt/tomcat/temp/tmp-images1570439806870910607 (deleted)
  java    DIR  253,0   6  136899237 /opt/tomcat/temp/tmp-images2456811184361231168 (deleted)
  java    DIR  253,0   6  136899237 /opt/tomcat/temp/tmp-images2456811184361231168 (deleted)
  java    DIR  253,0   6  136899238 /opt/tomcat/temp/tmp-images8109733179118089091 (deleted)
  java    DIR  253,0   6   69527104 /opt/tomcat/temp/tmp-images8763413559313243911 (deleted)
  java    DIR  253,0   6  136927313 /opt/tomcat/temp/tmp-images8168355305097994981 (deleted)       
  </code></pre>
  
  <p>How to delete nio2 temp directory without open file handle?</p>