backends: X11: Avoid dereferencing closed window

If X11 backend has two windows opened and one of them
was closed the pointer to last window in event parser may
became invalid. Now it's cleared when window is closed.

Signed-off-by: Cyril Hrubis <metan@ucw.cz>
backends: X11: Flush connection when window was closed.

If one of the windows was closed the connection needs
to be flushed so that it's removed from the screen immediately.

Signed-off-by: Cyril Hrubis <metan@ucw.cz>