Properly flushing i/O