Fall back to writing to stdout in TraceOutput if there's an error writing to stderr.
On Fedora, writing to stderr fails with EAGAIN from the context of atexit handler.
Falling back to stdout is better than ignoring the output, since that makes the debugheap useless.