I don't use LC but does it have an option to check for open vectors?
Due to the short movement in your code I suspect you have an open vector, enough to give you a z movement.
If you want to post the dxf drawing or email it to me I'll look at it for you.
gary