Enable use of atexit() on macOS and related platforms. The atexit() man page indicates that this is expected to behave in the expected way on unloading of shared libraries.