Fixed modal so it can be closed with ESC

* Fixes: #5343