added some stats on exit (windows tested / linux not tested)
exit handler fix (for linux)
proper signal handler for linux
stats fixed and signal handler fixed for linux