Add shutdown handler