fix error file flush