Donald Trump has questioned whether Britain remains America's closest ally and warned Nato's future is at risk over the Iran crisis.