close_portdbapi_caches: portage.db atexit hook

The python interpreter does _not_ guarantee that destructors are
called for objects that remain when the interpreter exits, so we
use an atexit hook to call destructors for any global portdbapi
instances that may have been constructed.
emerge --metadata/regen: flush portdbapi cache