MODE-2221 Moved the SelfClosingInputStream to the common package and changed it so that it only wraps (and closes) and InputStream. 

This is the same PR as https://github.com/ModeShape/modeshape/pull/1142, but ported to `master`, where the previously mentioned PR does not cherry-pick cleanly.