added check to prevent closing the GUI while server is running
added windows shutdown detection
fixed possible nullpointerexception