Nearly 9,000 people died last year attempting to cross borders, the UN agency for migration has said.