libmemdisc: flush output FIFO once upon exit()

We've tried a lot to do the flushing of the output FIFO right.
First we've tried the library destructor which didn't work, then
we've flushed periodically upon SIGALRM and currently we flush
upon free(). But that's too complex and too often. We only need
to do it once upon exit before file descriptors are closed.

So use atexit(). Multiple functions can be registered with it.
This way it can't conflict with the game code. Let ugtrain wait
250 ms before killing the worker to give it a chance to process
the final flush.

See exit(3), atexit(3) and _exit(2) man pages for details.