Expose the close() method and implement Closeable

Also some minor cleanups for unused things.