Ensure input stream is closed.