Using a function like .mkString or .getLines directly on a Source opened by fromFile, fromURL, fromURI will leak the underlying file handle.
.mkString
.getLines
Source
fromFile
fromURL
fromURI
Consider using .close() with try / finally to manage the resource's lifetime.
.close()
try
finally