title: Why is Files.lines (and similar Streams) not automatically closed?
body: <p>The javadoc for Stream states:</p>
  
  <blockquote>
    <p>Streams have a BaseStream.close() method and implement AutoCloseable, but nearly all stream instances do not actually need to be closed after use. Generally, only streams whose source is an IO channel (such as those returned by Files.lines(Path, Charset)) will require closing. Most streams are backed by collections, arrays, or generating functions, which require no special resource management. (If a stream does require closing, it can be declared as a resource in a try-with-resources statement.) </p>
  </blockquote>
  
  <p>Therefore, the vast majority of the time one can use Streams in a one-liner, like <code>collection.stream().forEach(System.out::println);</code> but for <code>Files.lines</code> and other resource-backed streams, one must use a try-with-resources statement or else leak resources.</p>
  
  <p>This strikes me as error-prone and unnecessary. As Streams can only be iterated once, it seems to me that there is no a situation where the output of <code>Files.lines</code> should not be closed as soon as it has been iterated, and therefore the implementation should simply call close implicitly at the end of any terminal operation. Am I mistaken?</p>