Glass formation and dormancy in bacterial spores