automatically run _finalize using atexit