cleanup when the task is killed and we're backgrounded