terminate after file is exhausted if invoked with a file argument