Fix #16: close correctly dialog when clicking on background