Add shutdown function.