terminating task if it doesn't exit