The end of a stream can be clipped by setting the granulepos of the last page to a lower value that it otherwise would be.