Change onexit to atexit