flush stream at end of generation