This issue was solved with changeset r36932.
Eric, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
io.c (nogvl_close, maygvl_close, nogvl_fclose, maygvl_fclose):
new functions.
io.c (fptr_finalize): release GVL if possible.
Patched by Eric Wong. [Feature #4570] [ruby-core:35711]