Delete the function when the query goes away.