Implemented functionality to stop the server programmatically