fixed inputstream not being closed