Fix bug that leaves fds in select after EOF received

This fixes an issue I ran into where ssh-agent pipes were left open after we received EOF.  I reported it as a fabric issue here:

https://github.com/fabric/fabric/issues/876

This breaks out of the select loop and closes pipes when select returns an fd that is ready with 0 read (EOF).