Sorry about the problems - let me try to give some of the horrible detail.
Just to explicitly rule out the situation (this can always be addressed later) the code does not deal with the case of a new document being created based on the template - and this may cause some problems in testing.
The Document_Open routine in the Template should run when either an existing document based on the template is opened, or when the template itself is opened for editing. All should be fine when it's a document being opened.
Often (as in this case - where running the open code would mean taking explicit action later to avoid the variables being saved) the code is not relevant when the template itself is being opened for editing and, so, I have explicitly bypassed it with this line
The Document_Close routine runs when a document based on the template, or the template itself is closed. Again, all should be well when it's a document (and the Document_Open code has run when it was opened).
If ActiveDocument Is Me then Exit Sub
When the template has been opened for editing and is then closed, the Close code runs and I would like to begin with the same escape line as above, BUT ...
What appears to be a bug with documents based on your template, and, I am guessing, with such locked documents in general is that, in the Close event (and maybe elsewhere) ActiveDocument is returning the template instead of the document. Having a check for the active document being the template, thus, means that the code doesn't ever run and so I have had to take that line out.
One effect of this is that when you have edited the template, the Close code tries to run, and fails. This is annoying but you can just cancel the code when this happens. Something better clearly needs to be found for a live situation!
One final point - as I said above I have explicitly excluded the creation of new documents. When a new document is created, the Open event code does not run (the Document_New event runs instead). This means that the same error can occur when the Close event runs but the Open hasn't run. Again, in testing, this an be skipped over.
Sorry it's rather a mess. I will try to produce something more solid later.