mainwindow: better implement close event
there are two ways of closing a window: via the (x) button
or via the quit entry at the menu (Ctrl-Q). Make both to
use the same code, being sure that the current settings will
be saved on any case.
Signed-off-by: Mauro Carvalho Chehab <firstname.lastname@example.org>