Allow closing dialog via template click handler