Get Solid White Light after Calling WiFi.off()

I’m trying to turn off the WiFi module on the Photon after a brief period of inactivity.
So I set up a timer:

Timer InactivityTimer(60000, HandlerInactivity);

Then I have the callback function:

void HandlerInactivity() {
// Turn off Wifi
WiFi.off();
// Turn off the timer
InactivityTimer.stop();
}

After a minute the Photon LED turns white, breathes once and then stays solid white.
I’m not sure what’s going on.

I should also add that the Photon seems to have crashed as well.

Update…

So I changed the callback handler so that it disconnects from the Particle cloud before turning off WiFi.

void HandlerInactivity() {
bool a;
Particle.disconnect();
do {
a = Particle.connected();
}while(a==true);
// Turn off Wifi
WiFi.off();
// Turn off the timer
InactivityTimer.stop();
}

This seems to have done the trick.
Only thing is I don’t know why.