Very similar to Python's "finally" keyword [0] used in a try block, the "Exit Traps" are meant to allow for clean-up action(s) if a script fails.
[0]: https://docs.python.org/3/tutorial/errors.html#defining-clea...
It is better to avoid bash scripts altogether :)
This appears to be a duplicate of a recent post.
https://news.ycombinator.com/item?id=36400465