The US announces a new deal with Iraq to conclude its military mission, with troops leaving longstanding bases amid regional tensions.