checking db on app closing