CN loses appeal and must pay for grade separations