added proper termination of deployments