Make sure to dismiss modal

There was a bug that meant the modal dialog wasn't aways getting to dismissed