Delay opening file until there is data to write