Handle thrown exception in widgets when 'captureOutput' is set to true.

When a Widget throws an Exception and the option `captureOutput` is set to `true` it messes up the rendering of the view.

In this pull request I catch the exception, flush the output buffer, turn off output buffering (using `ob_end_flush()`) and then throw the exception to the upper level.