Fix transient test failures for real this time.

Feeling pretty good about this one ;) Apparently the
causes for errors in the virtual frame-buffer differ
from ones seen when testing on a unity desktop
resulting in two different failure modes.

While my test on the unity-desktop failed due to delays
in closing the window the xvfb ones seem to need explicit
event processing after the virtual escape button press.

Also added try_repeatedly function to helpers to be able
to not have to hard-code guessed delays for window close.