Finish application when the last window is closed