catching various program termination signals