Added test of server before exiting settings and cancel button