It’s easier to discern the beginning of an illness in order to anoint than to assess the right point near a person’s death for viaticum.
What if we get the timing wrong for viaticum? PCS says:
183. It often happens that a person who has received the eucharist as viaticum lingers in a grave condition or at the point of death for a period of days or longer. In these circumstances, he or she should be given the opportunity to receive the eucharist as viaticum on successive days, frequently if not daily. This may take place during or outside Mass as particular conditions permit. The rite may be simplified according to the condition of the one who is dying.
Viaticum may be repeated. Every day, if needed. Repeat liturgies should be sensitive to the pastoral situation with the dying person and loved ones.