rooting – How can I relock my Xiaomi bootloader without bricking the phone?

I unlocked the bootloader on my Xiaomi Mi A1, and it boots fine.

However, after I relocked it (using the top answer here) and rebooted, the phone flashed the white Android loading screen then went black. The same thing happens when I try to boot into recovery mode. I can still get into fastboot, though, and am able to unlock again.

How can I lock the bootloader and return to the stock Android that the phone was shipped with? I’m not worried about data loss.