Use sf_open_virtual() instead of sf_open_fd() if file name is given