Fix regression in Task#terminate in c52b0a18