Dont apply TE changes when TE editor is terminating, fixes #327