Make data classes AutoCloseable