Kill corresponding thread when pausing a task