Cleaning up TERM handling