As Chile approached a critical presidential run-off, Peru declared a state of emergency at its southern border, anticipating an influx of migrants.