close output buffer for widget on exception
close output buffer for widget on exception

while running bootstrap extension unit tests which were failing first
I found phpunit complaining about risky tests because output buffers
were not closed correctly. This change fixes this problem.

close #7844

yiisoft/yii2-framework,yiisoft/yii2-framework