First, you need to move "Base is not occupied" condition above "Pick nearest". But that won't fix the problem completely, because the nearest base will not always be the correct one. For example here the nearest unoccupied base for blue sprite is the one with the green circle:
You need to pick only the bases which are connected to this button. You can use the Path sprite if you extend it slightly so that it overlaps Base sprites.
Button is overlapping Path
Path is overlapping Base
Base is NOT occupied
Pick nearest Base
Or you can give unique IDs to each base and specify on the button which bases it's connected to.