This line is at the wrong location:

- you are trying to close the handle even when it is not a resource, which is wrong. It should be inside the ``if``
- you are not closing the handle before throwing the RuntimeException, which means a potential memory leak