Return error code 1 on broken pipe, and restore compatibility with Python 2.5