title: What's the right way to use scala.io.Source?
body: <p>In many examples, it is described that you can use <code>scala.io.Source</code> to read a whole file like this:</p>
  
  <pre><code>val str = scala.io.Source.fromFile("test.txt").mkString()
  </code></pre>
  
  <p>But closing the underlying stream is not mentioned.</p>
  
  <p>Why does Scala not provide a convenient way to do that such as with clause in Python? It looks useful but not difficult.</p>
  
  <p>Is there any other better way to do that safely in Scala, I means to read a whole file?</p>