Fix Ctrl+D Crashes and Freezes (#296)

Cleaned version of https://github.com/p-e-w/finalterm/pull/306
`waitpid` needs to be called whenever a child process exists, not only if it was killed. You can see this by the fact that simply closing tabs with the "X" button creates zombies again.