merge_pr_28433
Move the location where we send the "close thread" message so it will always happen when we're waiting on the thread to join. Also stop blocking forever on queues, but spin the loop every second to check if the connection closed flag got set. Differential Revision: https://phabricator.services.mozilla.com/D111323 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1703921 gecko-commit: f22a4ed1ed22fe69008fc1036c81baec9e1c4527 gecko-reviewers: twisniewski