+1 for `Closeable`. Also, if we think we are going to use this pattern enough we should start looking at ARM libraries (like https://github.com/jsuereth/scala-arm).