Fix run_in_terminal wedging when cached terminal is disposed
#311019
+25
−1
Merged