Move buffer-destruction code into Task, where we want it for other uses.