stop thread when shutdown