Finish the query.