Add `terminateApp` and stop using `publish.when`.