Pope Francis has ended his historic trip to Iraq with a visit to Mosul in the country's north, a former stronghold of the terror group Islamic State.