files might be closed by multiple threads (unix)

Details

Description

io_util_md.c fileClose can close the wrong file.

If two threads enter this function, both might try to close the same file descriptor. This is dangerous, as the OS may have already reused the file descriptor after the first close for a third thread. We see this in our JRuby tests (the double close, not the bad case with the third thread).