Fix CLI to exit when server is shutdown