Cleanup the flushErrors function.