WeMos self-turn-off with N-channel MOSFET
I think , because you are using the WeMos to turn itself off, what is happening is as the MOSFET turns off, the voltage on the pin driving it goes up.

Or to put it another way, the pin driver is standing on the ground it is trying to pull up.

This is what you are trying to do..







simulate this circuit &ndash; Schematic created using CircuitLab

Without studying the specs on the device that internal pull-up may or may not be present and controllable.

At some point it will turn into some form of linear regulator or oscillate.

You may have more success using

pinMode(5, INPUT);


instead of 

digitalWrite(5, LOW);


That will allow the pull-down to do it's job, assuming that pull-up does not exist or can be turned off. 

If it exists and can not be turned off, you need to significantly reduce the pull-down value and gate resistor and add another one to the switch line and eat the current loss through the divider.







simulate this circuit

However, either way, cutting it's own throat may be problematic since the device may reset itself during the power down or brown out.