implemented AutoCloseable interface