Pin 4 should be a 24VDC supply, not an output.

If your spindle doesn't have a push button, and going by your photo, it does look like Pin 6 is a thermal switch, in which case once configured in UCNC, it should be able to trigger a stop.