I wrote a script and ran into an odd behavior. Some terminal windows it is run in would suddenly close before the script was completed running.
After a few hours of inves