The US president does not rule out military action in Iran, as Tehran temporarily shuts its airspace to nearly all flights.