termibnate program properly