{% for group, fields in form %}
  <fieldset
  {% if not group %}
    class="nolegend"
  {% endif %}
  >
    {% if group %}
      <legend><span>{{ group }}<span></legend>
    {% endif %}
    {% for field in fields %}
      <div id="form_row_{{ field.name }}" class="row {{ field.div_class }}">
        {{ field.render }}
      </div>
    {% endfor %}
  </fieldset>
{% endfor %}

{% for group, fields in form %}
  <fieldset
  {% if not group %}
    class="nolegend"
  {% endif %}
  >
    {% if group %}
      <legend><span>{{ group }}</span></legend>
    {% endif %}
    {% for field in fields %}
      <div id="form_row_{{ field.name }}" class="row {{ field.div_class }}">
        {{ field.render }}
      </div>
    {% endfor %}
  </fieldset>
{% endfor %}

Fix the invalid HTML tag closing for span tag in generic form fields generation template.
Fix the invalid HTML tag closing for span tag in generic form fields generation template.
