send response AFTER all queries are finished