app,api: make sure UnsetEnvs doesn't restart when there are no units