More shutdown and error condition handling improvements.