Rely on the fact that shell is a process group leader to make sure exit commands are executed.