Deref dedupe template module when module fn is called.
Merge pull request #361 from mzgoddard/dedupe-plugin-late-module-fn

Deref dedupe template module when module fn is called.