flags_shutdown() is now private and called automatically at exit.