[fix] pid close: win/linux, style, normal quit

Nicer code
Handle normal exit despite calling twise the atexit
TODO: fix ctrl-C at bad time causing some lock and handle double signal then
[fix] abort when sign during signhandler pid lock

Abort when we get another signal while still handling
first signal.

This can happen because handling signal like ctrl-C can
sometimes hang, probably because current cleanup
code it too high-level and is not suitable to be
true signal handler.

At least now we more nicelly abort (e.g. ctrl-C at startup
get hang and then killall gets app to say it will abort
and do abort)
fix a few NULL dereference errors
more static analysis