Building blockchain using GoLang

I was currently reading an article on freecodecamp site (guide to building blockchain from scratch) LINK and there is something you can help me understand, because I can’t.
There is a function which writes to file series of objects from array in json format using for loop, and deleting each object at the end of iteration. Here is the code

func (s *State) Persist() error {
   // Make a copy of mempool because the s.txMempool will be modified
   // in the loop below
   mempool := make([]Tx, len(s.txMempool))
   copy(mempool, s.txMempool)

   for i := 0; i < len(mempool); i++ {
      txJson, err := json.Marshal(s.txMempool[i]) // my 1st question is about this line
      if err != nil {
         return err
      }

      if _, err = s.dbFile.Write(append(txJson, '\n')); err != nil {
         return err
      }

      // Remove the TX written to a file from the mempool
      // Yes... this particular Go syntax is a bit weird
      s.txMempool = append(s.txMempool[:i], s.txMempool[i+1:]...) //me 2nd issue
   }

   return nil
}

What I don’t get it is this:

  1. if we are removing elements of the array, but still using the same original array (not a copy) to read from it , that means that we are reading only each second element - why not using the copy which we made beforhand?
  2. this (which even author called “weird”) removing elements from the original array. Using variable i over there causes all sorts of problems, like trying to reach out of range of the array after few iterations and so on.

I have testing this with slices of regular integers and it didn’t work at all.
Could someone explain to me how this is working?