In multithreaded programs there is a small race window where a file descriptor is closed twice. If in that small window in another thread a new file descriptor is created with the same fd handle/number it will get immediately closed causing wierd bugs. The fix is simple, don't close the file descriptor twice. See https://sourceware.org/cgit/elfutils/commit/?id=938a52c22ee915ff2cea813edd5da66bc8184885