Modified flush to hflush to write to disk immediately