stream-file: handle end of stream a bit more gracefully.