Fix Ctrl+D Crashes and Freezes (#296)

Cleaned version of https://github.com/p-e-w/finalterm/pull/306
Yes, I did see that issue, unfortunately (as well as other weirdnesses where tabs suddenly closed, or did not close, or the wrong tab was closed). I assume these issues are all triggered by this timing problem.