add atexit cleanup in config