Added by Rob Nahf about 10 years ago
bug fixes and refactoring to simplify closing remote inputstreams (that hold / block connections).