Fix crash in close_section.
Clarify code example in documentation.