Used named inner classes in createTemplate

Instead of creating anonymous inner classes use named inner classes in the createTemplate method.
This change reduces memory usage by:
Reducing the number of classes defined to only 2 instead of 2 per page
Causing the pageCache to not hold a transitive reference to the Callable class, allowing it to be garbage collected

See GRAILS-11711
Merge pull request #536 from candrews/patch-13

GRAILS-11711: Used named inner classes in createTemplate