This is a common idiom for handling (or better: not handling) exceptions in code that is allocating resources.
If an exception occurs in a try block, this block will end abruptly. Then a corresponding catch statement will be looked up. If this is not found than the outer block will end abruptly, which most of the times means that the method will throw this exception to its caller.
But before that a finally block will always be executed after leaving the try block (and even after handling a caught exception). This is the best place to dispose any allocated resources. In that way you make sure that you clean up after your work, whether an exception occurred or not.