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

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