Trap SIGEXIT appropriately during exits