store the list of 'atexit' functions using linked list macros (issue #6329)