Run pending queries on shutdown/reload