Simplified connection closure in the mock server.
Fixed a mistake where calling shutdown() a second time might not return the full list of unsent notifications.