running the stop process in a separate thread