closing the input stream when not in use