I decided to use `Option` because I'm a personal quest to avoid using `null` in Scala. 

Unfortunately, there's no way (at least that I can think of) to avoid using the `var` here. The problem is:
1. You need the resource variable to be in-scope for both the `try` and `finally` blocks, so they must be declared outside of the blocks.
2. Opening any of the resources might throw an exception, and the exception might be thrown after some resources have already been opened. Therefore the exceptions must be caught and dealt with (by closing resources that were already opened).  Therefore the opening / initialization of the resources must happen inside the `try` block and not outside of it.
3. This necessitates the declaration appearing outside of the block, but initialization happening inside the block, which means you need a `var` and not a `val`.