Added more code to deal with bad file descriptors.
Added more code to deal with bad file descriptors.

digitalbazaar/monarch,digitalbazaar/monarch,digitalbazaar/monarch,digitalbazaar/monarch,digitalbazaar/monarch