Stuck in autolevel routine

When I try to print locally the printer gets stuck in the autolevel routine. It will touch the 10 points on the bed, then go back to the start and do it all over again. I can't cancel or pause it. It just keeps going forever until I turn the printer off.

I tried printing it directly from the SD (the exact same Gcode) and it worked fine. The problem is I want to use the "Exclude Region" plugin that apparently only works printing locally.

Am I missing a plugin or something?

This is the beginning of my Gcode (created by Craftware)
G28 X0 Y0
G28 Z0
G29
M999

M140 S50 ;set bed temp (no wait)
M104 S165 ;set head temp (no wait)
; ------------------------------------
; Layer #0
; ------------------------------------
G21 ; mm
G90 ; abs
G92 E0 ; reset extr
M106 S0
;segType:Skirt
G0 F2400 E-0.4000
G0 F300 Z0.300
G0 X105.139 Y142.354 F10800
G0 F2400 E0.6000
G1 X107.351 Y144.509 E0.7078 F1200
G1 X107.627 Y144.779 E0.7213
G1 X107.834 Y144.981 E0.7314

Where does the M999 come from and what happens if you remove it?

Its supposed to be some sort of error reset.

I removed it and it worked!

Thanks!