Fix race condition in erc-server-send-queue vs quitting erc

* lisp/erc/erc-backend.el (erc-server-send-queue): Check that the
buffer is live before using it (bug#40418).  This fixes a rare
problem when the queue is non-empty when `erc-quit-server' is run.
1 job for master in 43 seconds (queued for 6 seconds)
Status Job ID Name Coverage
failed #6796


Name Stage Failure
test-all Test
error: cannot lock ref 'refs/remotes/origin/master': Unable to create '/builds/emacs/emacs/.git/refs/remotes/origin/master.lock': File exists.

Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.
fatal: failed to run reflog
ERROR: Job failed: exit code 1