I tested the proposed version and it works.
I executed: sleep 10 && killall -9 gedit
, then minimized gedit. In 10 seconds gedit was gone.
One minor thing: I had Thunderbird minimized that time and its window got restored from minimized state at the same time when gedit died. As if I had clicked on the launcher icon to bring back the window to the desktop.