HashGroupingOperator has been updated to close inbound pages. Ordinals needs to do similar.
x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/OrdinalsGroupingOperator.java
}
            while (pq.size() > 0) {
                final AggregatedResultIterator top = pq.top();
                if (position == startPosition || lastTerm.get().equals(top.currentTerm) == false) {
                    position++;
                    lastTerm.copyBytes(top.currentTerm);
                    blockBuilder.appendBytesRef(top.currentTerm);
                }
                for (int i = 0; i < top.aggregators.size(); i++) {
                    aggregators.get(i).addIntermediateRow(position, top.aggregators.get(i), top.currentPosition());
                }
                if (top.next()) {
                    pq.updateTop();
                } else {
                    pq.pop();
                }
            }
            int[] aggBlockCounts = aggregators.stream().mapToInt(GroupingAggregator::evaluateBlockCount).toArray();
            Block[] blocks = new Block[1 + Arrays.stream(aggBlockCounts).sum()];
            blocks[0] = blockBuilder.build();
            IntVector selected = IntVector.range(0, blocks[0].getPositionCount(), BlockFactory.getNonBreakingInstance()); 
            int offset = 1;
            for (int i = 0; i < aggregators.size(); i++) {
                aggregators.get(i).evaluate(blocks, offset, selected);
                offset += aggBlockCounts[i];
            }
            return new Page(blocks);
        } finally {
            Releasables.close(() -> Releasables.close(aggregators));
        }