remove atexit handler, account for both exit paths