improvement of Application::end() handling.
app end improvement.