widget: Do not leave behind a zombie child when closing a terminal

https://bugzilla.gnome.org/show_bug.cgi?id=740929
(cherry picked from commit 31b150146189b49fadd126edc1c373ada234c865)