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
if (false == sortedSetDocValues.advanceExact(doc)) {
                    builder.appendInt(0);
                    continue;
                }
                int count = sortedSetDocValues.docValueCount();
                
                if (count == 1) {
                    builder.appendInt(Math.toIntExact(sortedSetDocValues.nextOrd() + 1));
                    continue;
                }
                builder.beginPositionEntry();
                for (int i = 0; i < count; i++) {
                    builder.appendInt(Math.toIntExact(sortedSetDocValues.nextOrd() + 1));
                }
                builder.endPositionEntry();
            }
            return builder.build();
        }
        int docID() {
            return sortedSetDocValues.docID();
        }
        /**
         * Checks if the reader can be used to read a range documents starting with the given docID by the current thread.
         */
        static boolean canReuse(BlockOrdinalsReader reader, int startingDocID) {
            return reader != null && reader.creationThread == Thread.currentThread() && reader.docID() <= startingDocID;
        }
    }
}