closing the inputstream after exception