Gracefully exit when the input stream is ended.
wip