Improve program exit behavior