Adding end of file processing.

@wfrench Please review.