Patch to allow controlled exit of a service.