stop server correctly