File: fixed possible infinite loop when 'Broken pipe' occurs.