Move NMSToolBox to util, fix shutdown sequence