Fixed a race condition concerning message handling in kiro client