make sure that input streams are getting closed, because otherwise a too many open files issue can be created