Simplify semiopen_file (#2165)