fix(dialog): close dialog on location change

Closes #335