Split the shutdown sequence into a second file to reduce the cahnce of unhandleed exceptions breaking the shutdown sequence. Also imrpoved debug messages