! File ended while scanning use of \dododowithbuffer.
<inserted text>
\par
Remove the {}'s at the beginning and all is well.
The culprit however is the % in the first line; remove and the braces do no harm.
I suspect that a missed newline is the cause. If that cannot be remedied, I advise adding a warning in the manual.