Use the correct method when closing the template