gresolv: Remove query from queue before destroying the query