Fix try-with-resources statement in Java 7

http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html

as using() {} in C#