Fix file descriptor leak.
Fix file descriptor leak.

Close an InputStream when finished reading it. When given an
OutputStream to connect to a process input, close it when the
transfer is completed. Protect System.in in this latter case.

xuwei-k/xsbt,sbt/sbt,sbt/sbt,mdedetrich/sbt,sbt/sbt,mdedetrich/sbt,sbt/sbt,xuwei-k/xsbt,mdedetrich/sbt,mdedetrich/sbt,sbt/sbt,mdedetrich/sbt,xuwei-k/xsbt,mdedetrich/sbt,sbt/sbt,xuwei-k/xsbt,mdedetrich/sbt,Duhemm/util,sbt/sbt,xuwei-k/xsbt