close stream after decode