invoke callback on stream end