Fix error on close when the popup has not been displayed

Hi,

This is just a micro fix to prevent that a error occur (l.255) when we try to call "close" function while the popup has not been displayed before.

Best regards.