Causing the motor to slow down nearly to a stop is very bad for your whole electrical system. If you can, pedal harder. At first, it will be a struggle, but your legs will soon get stronger as long as you try. In the long term, both you and the bike will be better for it.