safe quit thread