If your ticket is canceled because the gate agent manually offloads you from the flight, you will pay the $125 fee. If you cancel your ticket first, there is no fee.
This will happen no earlier than 15 minutes before domestic departures and 30 minutes before international departures, but I would strongly recommend canceling at least 1 hour before, so as not to roll the dice on the cancellation making it through UA's myriad systems in a timely manner.