Make pointers AutoCloseable