move the shutdown call back to python