call stream#end method on end