SERVER-8510 Use ferror to check error instead of checking for num bytes read