App quits after window is closed