Better program exit checks