disposed the template resources after using them