Instead of repeated try/finally blocks, how about using https://github.com/jsuereth/scala-arm ?