diff --git a/io.c b/io.c index 7aba8be12f..ed8bc1ee3b 100644 --- a/io.c +++ b/io.c @@ -9017,6 +9017,7 @@ rb_f_backquote(VALUE obj, VALUE str) GetOpenFile(port, fptr); result = read_all(fptr, remain_size(fptr), Qnil); rb_io_close(port); + RFILE(port)->fptr = NULL; rb_io_fptr_finalize(fptr); rb_gc_force_recycle(port); /* also guards from premature GC */