I have had quite a few mechanical crashes after adding this end code, it works fine for the first print, but causes crashes at the beginning of a new print. See my original post above.