code: def finishEditing(self, tag):
          
          curr_item = self.currentItem()
          create_item = self.createItem()
          self.closePersistentEditor(curr_item)
          
          if curr_item == create_item:
              self.addTag(tag)
          
          elif self.isTagValid(tag):
              curr_item.setText(tag)
docs: Finishes editing the current item.