ensure that the input stream is closed after use.