Fix for IO#fileno when its closed