Fix infinite loop occurring when an error is encountered during ofstream flush
Fix infinite loop occurring when an error is encountered during ofstream flush

PetteriAimonen/ustl,uusirant/ustl-cmake,msharov/ustl,Gerii/ustl,PetteriAimonen/ustl,uusirant/ustl-cmake,PetteriAimonen/ustl,dgruss/ustl,NoSuchProcess/ustl,dgruss/ustl,szastupov/ustl,Gerii/ustl,szastupov/ustl,msharov/ustl,NoSuchProcess/ustl