Fix to thread cleanup during stop_relaying