Minor refactoring

Pressing the 'x' (close) button now exits the app. It was unnecessarily
complicated to redirect the control flow for when the app was closing.