There are some Z moves in your start and end code, try adding ; E to them so that the DWC picks up the E and assumes it's an extrusion move and ignores them as Z moves.
In the start code: G1 Z5 F5000 ; lift nozzle 5mm and G1 Z0.28 F240
In the end code: G1 Z20 F500 ; lower bed 20mm from current position
If that doesn't work, you can try splitting out the Z moves into separate macros at calling them with M98 P