Added code to stop heating and stepping when there's an error.