This will segfault if someone has redefined `IO` and the object passed is not an RFile