Add cleanup(), start changing things to call it instead of doing raise/sys.exit