stop method
Stops the agent and closes the connection.
Implementation
Future<void> stop() async {
_running = false;
await _runtime?.stop();
_runtime = null;
await _runtimeStates?.cancel();
_runtimeStates = null;
_setState(AgentState.offline);
if (!_states.isClosed) await _states.close();
}