scanner: stop threads when there're not destinations
Exit the scanner with error stoping threads first when there is not
any functional destination, since the destinations can not be recovered.
After merging #28897, `stop_threads` can be used (instroduced in #28869).