Just some nitpicking about the formatting: the finally should be on the same line as the closing curly bracket and there should a a space, i.e.

    try {
      ...
    } finally {
      ...
    }