Check whether there is any BadWindow error before monitor the event
The tray window itself may be destroyed before we start monitor the
event of it. Check the returned error and skip this window if BadWindow
happens.
FIXED-IN: 5.6.0
BUG: 358719
REVIEW: 127014