code: def set_close_function(self, func):
          
          state = func is not None
          if state:
              self.sig_close_tab.connect(func)
          try:
              # Assuming Qt >= 4.5
              QTabWidget.setTabsClosable(self, state)
              self.tabCloseRequested.connect(func)
          except AttributeError:
              # Workaround for Qt < 4.5
              close_button = create_toolbutton(self, triggered=func,
                                               icon=ima.icon('fileclose'),
                                               tip=_("Close current tab"))
              self.setCornerWidget(close_button if state else None)
docs: Setting Tabs close function
          None -> tabs are not closable