Properly close input stream.