Fix Ctrl+D Crashes and Freezes (#296)

Cleaned version of https://github.com/p-e-w/finalterm/pull/306
As small as the possibility may be: This *still* does not guarantee that the right widget is closed (e.g. if the file sync is slow for some reason).