The guard is useful to make sure that when you get outside of the current scope, the previous stream is restored (even if an error is thrown in the current scope).
So you are sure that you don’t “polute” the current stream of your parent function.