Is there an event if the user pops a template with the backbutton

I want to clear certain state when closing a template when the user clicks the backbutton