title: How to read a file line by line and close it afterwards in Scala?
body: <p>Normally, they will tell you to </p>
  
  <pre><code>import scala.io.Source
  for(line &lt;- Source.fromPath("myfile.txt").getLines())
    println(line)
  </code></pre>
  
  <p>which seems to leave the file open. What is a closeable counterpart?</p>