You never set the canBuild variable to false, so if the player touched the building once it will stay selected for upgrade.
In OnTriggerExit add canBuild = false;
↧