keep task state after stream end to maintain the output buffer