Only set task state to WAITING if the job is not finished.