Use single_open instead of manual manipulations.