A stochastic epigenetic switch controls the dynamics of T-cell lineage commitment