[AS7-5439] wait for operations to complete before shutting down the serv...

...er