Replace __del__() by close()