Added __del__ methods to handle close if necessary.