The master switch is responsible for performing the management tasks of the stack. Which switch you choose to use for the uplinks, whether etherchannel or not, has no affect on the choice of master switch or choice of the backup master switch (with the second highest priority). So if the scenario you described happened, connectivity would still be maintained via the second link from the 5th switch.
Remember that the stacking of switches will take place (ideally) using a closed loop stack. This is where SW1 is connected to SW2, SW2 to SW3, SW3 to SW4, SW4 to SW5 and SW back to SW1 thus creating a loop. If any single switch goes down or if any single stack link between switches goes down, all switches are still connected because of the loop. The only way some switches will become isolated and subsequently disconnected is if two switches, such as SW2 and SW5 fail.
The uplinks however can be on any switch in the stack and even a failure of the master switch will still allow the uplink to function.
I hope this has been helpful!