Execute as a shutdown function.