[BUGFIX] Set closing tag at the correct position

Follow-Up / Bugfix for https://review.typo3.org/34253/

Resolves: #63016
Releases: master
Change-Id: Icc0a7131b0d8a62df4e21d8166707ed96b276d1e
Reviewed-on: http://review.typo3.org/34257
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Benjamin Kott <benjamin.kott@wfp2.com>
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz <opitz.alexander@googlemail.com>