don't forget to return last chunk via queryEnd