Properly stop server.

This prevents resource leaks (such as ports remaining open and conflicting between tests).