Stop server on ESP8266

Hi,

Currently I’m working on a project with an ESP8266 module.
It’s running stand alone, I’m communicating and programming it with the arduino IDE using the ESP8266 library.(Link : https://github.com/sandeepmistry/esp8266-Arduino/tree/master/esp8266com/esp8266/libraries/ESP8266WebServer/src)

I’m starting the ESP as an AP, which displays a webpage. This is working.
Now, I want to visit this webpage with a mobile phone, and fill in a SSID and a password and let the ESP connect with a SSID which also works.

Now, I can’t shut down the server, running on the ESP. The server is started like this:

ESP8266WebServer server(80);

server.on("/", handleRoot);
server.begin();

Someone has a clue how to stop the server?

Kind regards,

Jan Paul