Trump made the threat after Spain refused to let the U.S. military use its bases for missions linked to strikes on Iran