daemon: terminate_server reduce code reuse