catch IOError if broken pipe (for example, with "head")