stopping server properly