Trying to clean up the shutdown process