Add shutdown code when pid is killed