Connects To The Device That's The Closest
Bluetooth does not provide any functionality for proximity measurement. The signal strength is an accessible measure (RSSI) but does not imply nearness: A nearer source behind a wall is likely to have weaker signal than a source in line of sight but much further away.

Depending on the actual purpose, switching between (previously paired) Bluetooth partners based on RSSI is a viable approach.

If proximity is a hard requirement, an ancillary mechanism using time of flight of a broadcast packet from the base unit to all listening units, and selection of whichever target responds first, is an option. Note though that if the responding unit has a delay in responding, this will throw all time of flight assumptions off.