Add END_SEGMENT flag and associated requirement. Fixes #350.

@jpinner, did you just forget to create the pull request?