Facing corruption accusations and pressure from Congress, Peru's President Pedro Pablo Kuczynski resigned just before an impeachment vote.