resolved crash when closing the app.