Make GenericObject.__del__ more robust