Getting a reset error on a WEMOS D1
If Watchdog timer is the cause of reset that means there is at least one place in your code that runs too long without allowing subsystems to do the background tasks. It might be possible the part of your code causing the problem is:

while(!Serial) ;


Instead that loop use:

while(!Serial)
  delay(100);


so the background tasks will get the chance to be exectuted during the while loop.

EDIT:
In fact you can completely remove that while loop as it is not necessary. There is a possibility !Serial is always true so the loop never ends. And I suggest you using 74880 instead of 115200 so you can see the debug messages sent automatically by ESP8266.
END OF EDIT

However, if that is not the part of the code that causes the problem (and I think it is not) then the problem might be for loop where you list networks. You can check if that is the problem by adding a small delay inside the loop as follows:

for (int thisNet = 0; thisNet&lt;numSsid; thisNet++) {
  delay(1);    
  Serial.print(thisNet);    
  Serial.print(") ");    
  Serial.print(WiFi.SSID(thisNet));    
  Serial.print("\tSignal: ");    
  Serial.print(WiFi.RSSI(thisNet));    
  Serial.print(" dBm");    
  Serial.print("\tEncryption: ");    
  Serial.println(WiFi.encryptionType(thisNet));    
}


If the problem will still exist then you can add a few more delay(1); statements through the code.

Instead of delay you may use yield(); which is the same as delay(0);.