return the error from `Flush` instead of `WriteString`
small rewrite