The timing of the demographic transition and economic growth