Quantum dynamics of the ultrafast heme-carbon monoxide photolysis and spin-crossover