Spain entering the war was a non-starter for a variety of reasons. In no particular order:
Economically, Spain was a mess. She was not producing enough food and was getting food from ...you guessed it, the allies.
The second that Spain attacked the allies, she would have lost her foreign possessions since she had no way to defend them.
The Spanish only had enough oil/supplies for an extremely limited amount of time and then Germany would have had to provide the remaining supplies.
A coup against the government was a real possibility if Spain went back to war. The country was in very poor shape and sending the troops out was hardly in the best interest of Franco.
In any case the British were already sending a large amount of their supplies around Africa, so closing Gilbralter would hardly automatically cost Britian Africa.