code: def close(self):
          
          widget = self.centralWidget()
          if widget and not widget.close():
              return
              
          super(XPopupWidget, self).close()
docs: Closes the popup widget and central widget.