issue #835
reverts fix introduced with 5b28c6ab00
as onEndRequest will fire event only once I added app->end() method as
shutdown function to make sure onEndRequest gets called in any case.
If application called it before shutdown function has no effect.