Add a destructor to directive template