Add shutdown function