Better yet, use try with resource constructs available in Java 7.