if the running thread is null stop the task