Improve broken pipe handling of CLI
Improve broken pipe handling of CLI

If the output of the NIPAP cli is being piped and the receiver of the
pipe is killed off before nipap (for example, using ^C) there won't be a
pipe anymore and Python will print an ugly "broken pipe" backtrace that
could look a bit different depending on which version of Python we are
running on but in general it confuses users. To avoid this, we register
an atexit handler which will try to close stdout before we exit and thus
suppress the message.

Fixes #464.

SoundGoof/NIPAP,ettrig/NIPAP,bbaja42/NIPAP,plajjan/NIPAP,garberg/NIPAP,ettrig/NIPAP,ettrig/NIPAP,fredsod/NIPAP,fredsod/NIPAP,SoundGoof/NIPAP,SpriteLink/NIPAP,bbaja42/NIPAP,SpriteLink/NIPAP,SpriteLink/NIPAP,plajjan/NIPAP,SoundGoof/NIPAP,plajjan/NIPAP,ettrig/NIPAP,fredsod/NIPAP,SoundGoof/NIPAP,bbaja42/NIPAP,bbaja42/NIPAP,SoundGoof/NIPAP,garberg/NIPAP,ettrig/NIPAP,bbaja42/NIPAP,plajjan/NIPAP,plajjan/NIPAP,SpriteLink/NIPAP,garberg/NIPAP,garberg/NIPAP,SpriteLink/NIPAP,ettrig/NIPAP,SoundGoof/NIPAP,fredsod/NIPAP,bbaja42/NIPAP,fredsod/NIPAP,fredsod/NIPAP,plajjan/NIPAP,garberg/NIPAP,garberg/NIPAP,SpriteLink/NIPAP