Add END_SEGMENT flag and associated requirement. Fixes #350.