Made sure program always cleans up after itself before exiting.