runghc: flush stdout/stderr on an exception (#3890)