[X Style (Pure) Android Development] Hasherx1:
To Relock bootloader with this process:

In order to relock the bootloader you can use the below lines:

Notice you have to do the fastboot oem lock begin command and follow it immediately with flashing all the partitions. Then at the end do a fastboot oem lock command .

[MENTION=279333]ECHO[/MENTION] Off
[MENTION=279333]ECHO[/MENTION] Test

adb reboot bootloader

fastboot oem lock begin

fastboot flash partition gpt.bin

fastboot flash bootloader bootloader.img

fastboot flash logo logo.bin

fastboot flash boot boot.img

fastboot flash recovery recovery.img

fastboot flash system system.img_sparsechunk.0

fastboot flash system system.img_sparsechunk.1

fastboot flash system system.img_sparsechunk.2

fastboot flash system system.img_sparsechunk.3

fastboot flash system system.img_sparsechunk.4

fastboot flash system system.img_sparsechunk.5

fastboot flash system system.img_sparsechunk.6

fastboot flash system system.img_sparsechunk.7

fastboot flash system system.img_sparsechunk.8

fastboot flash system system.img_sparsechunk.9

fastboot flash modem NON-HLOS.bin

fastboot erase modemst1

fastboot erase modemst2

fastboot flash fsg fsg.mbn

fastboot erase cache

fastboot erase userdata

fastboot oem lock

fastboot reboot

After running this as FLASH-ALL.bat here is the output I got:

As you can see below in RED the phone shows locked successfully.

Test

...

(bootloader) Please fully flash the signed build before locking the phone

OKAY [ 0.005s]

finished. total time: 0.006s

target reported max download size of 536870912 bytes

sending 'partition' (32 KB)...

OKAY [ 0.003s]

writing 'partition'...

(bootloader) This may take a few seconds, if a

(bootloader) different partition table is being

(bootloader) flashed since we need to backup

(bootloader) and restore a few partitions

(bootloader) Flashing primary GPT image...

(bootloader) Flashing backup GPT image...

OKAY [ 0.643s]

finished. total time: 0.648s

target reported max download size of 536870912 bytes

sending 'bootloader' (2699 KB)...

OKAY [ 0.061s]

writing 'bootloader'...

(bootloader) flashing aboot ...

(bootloader) flashing sbl1 ...

(bootloader) flashing pmic ...

(bootloader) flashing rpm ...

(bootloader) flashing tz ...

(bootloader) flashing hyp ...

(bootloader) flashing sdi ...

OKAY [ 1.651s]

finished. total time: 1.716s

target reported max download size of 536870912 bytes

sending 'boot' (40960 KB)...

OKAY [ 0.921s]

writing 'boot'...

OKAY [ 1.429s]

finished. total time: 2.354s

target reported max download size of 536870912 bytes

sending 'recovery' (41040 KB)...

OKAY [ 0.920s]

writing 'recovery'...

OKAY [ 1.441s]

finished. total time: 2.364s

target reported max download size of 536870912 bytes

sending 'system' (260220 KB)...

OKAY [ 5.535s]

writing 'system'...

OKAY [ 8.067s]

finished. total time: 13.606s

target reported max download size of 536870912 bytes

sending 'system' (252707 KB)...

OKAY [ 5.373s]

writing 'system'...

OKAY [ 6.960s]

finished. total time: 12.340s

target reported max download size of 536870912 bytes

sending 'system' (258179 KB)...

OKAY [ 5.489s]

writing 'system'...

OKAY [ 7.067s]

finished. total time: 12.559s

target reported max download size of 536870912 bytes

sending 'system' (261640 KB)...

OKAY [ 5.567s]

writing 'system'...

OKAY [ 7.338s]

finished. total time: 12.909s

target reported max download size of 536870912 bytes

sending 'system' (247577 KB)...

OKAY [ 5.268s]

writing 'system'...

OKAY [ 6.793s]

finished. total time: 12.065s

target reported max download size of 536870912 bytes

sending 'system' (256244 KB)...

OKAY [ 5.454s]

writing 'system'...

OKAY [ 7.292s]

finished. total time: 12.750s

target reported max download size of 536870912 bytes

sending 'system' (257510 KB)...

OKAY [ 5.484s]

writing 'system'...

OKAY [ 7.012s]

finished. total time: 12.500s

target reported max download size of 536870912 bytes

sending 'system' (257477 KB)...

OKAY [ 5.480s]

writing 'system'...

OKAY [ 6.946s]

finished. total time: 12.430s

target reported max download size of 536870912 bytes

sending 'system' (258112 KB)...

OKAY [ 5.493s]

writing 'system'...

OKAY [ 15.343s]

finished. total time: 20.838s

target reported max download size of 536870912 bytes

sending 'system' (215364 KB)...

OKAY [ 4.577s]

writing 'system'...

OKAY [ 10.933s]

finished. total time: 15.514s

target reported max download size of 536870912 bytes

sending 'modem' (41675 KB)...

OKAY [ 0.889s]

writing 'modem'...

OKAY [ 0.913s]

finished. total time: 1.804s

erasing 'modemst1'...

OKAY [ 0.007s]

finished. total time: 0.008s

erasing 'modemst2'...

OKAY [ 0.005s]

finished. total time: 0.006s

target reported max download size of 536870912 bytes

sending 'fsg' (1297 KB)...

OKAY [ 0.030s]

writing 'fsg'...

OKAY [ 0.051s]

finished. total time: 0.084s

erasing 'cache'...

OKAY [ 0.020s]

finished. total time: 0.020s

erasing 'userdata'...

OKAY [ 0.577s]

finished. total time: 0.579s

...

(bootloader) Phone is locked successfully!

OKAY [ 1.931s]

finished. total time: 1.932s

rebooting...

finished. total time: 0.001s

In the Device Bootloader it will say this:

Device is Locked. Status Code 2

Software Status: Modified

So I hope soon We find a way to set the Status Code back to 0 and the Software Status to Original

This worked like a charm for me as I had a bad charging port and have to send this back to Motorola for an exchange. They gave me the new phone already and I just needed to put the stock firmware back on and I locked the bootloader just so I knew how to do it.

Hope this helps everyone. Thanks to the dev for getting this figured out.