fix #1956: return controlling terminal to parent