Sorry for the delay, Kenneth.
Yes, it does the same thing when creating a new template from a barebones test page.
1. Created a test page, "cuteeditortest.aspx," and pasted your code directly to it.
2. Browses to the new test page.
3. Clicked on the "INsert Template" button.
4. Clicked the "Make Template" button.
5. Entered "Test7" as the name of the template and click OK.
6. Immediately clicked the red-X button to close the Make Template dialog, and the errors are thrown.
This does not produce the error:
1. Created a test page, "cuteeditortest.aspx," and pasted your code directly to it.
2. Browsed to the new test page.
3. Clicked on the "INsert Template" button.
4. Clicked the "Edit" button next to an existing template.
5. Immediately clicked the red-X button to close the Make Template dialog. No errors.