Fix shutdown and afterDispatch events not being fired on exceptions.

When exceptions are fired the shutdown and afterDispatch events should
be properly fired. This allows plugins and application code to ensure it
is run. Of course this creates the potential for infinite loops if these
events also trigger an exception.

Refs #5208
Merge pull request #5252 from cakephp/issue-5208

Fix shutdown and afterDispatch events not being fired on exceptions.
Merge pull request #5258 from AD7six/3.0-bake-test-fixes

3.0 bake test fixes
modify controller task to render in one step

Instead of baking actions seperately, and passing actions as a string to
the controller template - pass the array of action names directly to the
controller template