Changing flight mode during scripted flight

I am testing sitl using the simple_goto.py and decided to see what would happen if I changed the mode, then guided, to PosHold Mode. To my surprise, it just crashed. Any reason for this behavior?