fix bug where app would not close