Function blockWsHandlerShutdownUntilComplete

Prevents shutdown from being completed until the specified promise is complete. If shutdown was already complete, this does nothing.