Catch and handle a shutdown exception.