Fix: move runtime table cleanups to when we shut down