#12: use flush instead of flushAsyn when writing EOF