Executing undeploy when instances are removed