Attempt to fix stream closed exception.