<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def close_stream_on_error(func):
    '''Decorator to close stream on error.'''
    @asyncio.coroutine
    @functools.wraps(func)
    def wrapper(self, *args, **kwargs):
        with wpull.util.close_on_error(self.close):
            return (yield from func(self, *args, **kwargs))
    return wrapper