fn close_section_if_needed(xml: &mut String, state: &XmlState)
Closes the current section if one is open.