1. You do not need two event pages. Put the transfer command on the first page, where you turn on the switch, and get rid of the second page.
2. Add a WAIT X Frames at the top or bottom of page 1. You do not need to check the player's location 60 times per second. Make it wait 5 or even 10 frames.
3. You need to SET the variable for the map id before you use it. You set the variable for the player's X and Y positions, but you don't set the one for the map id. This needs to be the id of the map you want to transfer to, which you will probably have to do via Control Variables and just set it to a number, since you won't want to send the player to the same position on the same map, and you haven't given us any info to tell if you can do a calculation to determine the new map number.