Now implements the java.io.Closeable interface, to be used with java 7 try-with-resources