Add try-finally blocks in java snippets of file handling posts.