Fixed behavior on app close.