The race usually happens when `closeHandle()` and `prepareIo()` are called concurrently; the former tries to set `closing` to `true` the latter tries to read its value. In order to avoid this issue, we added a lock around the variable. Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>