Must reset s->stats_fd to zero before returning.