Make handling of QEvent::Close consistent with QWindow::close()

The event handler would ignore the close if the window was hidden
while the close() function would not. In addition, the close()
function would force removal of focus etc while the event handler
did not. Make it consistent by calling close() from the event
handler.

Change-Id: Ia05b08299f218620fb40a8cad5d3771158c4701e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Don't crash when platform plugin sends us two close events.

Change-Id: Icfe2954908fad2abfb4195fc535aadd1e6302f76
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Merge pull request #2 from sletta/window-close

[qtbase] Backport QWindow::close() fixes from Qt 5.4