destroy terminals on idle
Currently terminals are destroyed during the ::child-exited handler. While this is currently working, it's not good practise to destroy the object in a signal handler.
So this should be changed to queue the destruction to an idle.