Flush stream automatically