Added shutdown code to the MainReactor