app close bug fix