I've had some more time to test.
As mentioned in my previous post, it looks to me like we've got two different and distinct unlock states. I've taken to referring to them as "OEM unlocked" and "script unlocked".
Starting from OEM locked the script will continue to toggle back and forth between script unlocked and locked repeatedly with no problems - until any form of reboot into bootloader or system.
After any reboot into the bootloader or system the unlock state changes from script unlocked to OEM unlocked.
From OEM unlocked, the script will not switch back to locked. This appears to mean that after every reboot, if the bootloader is unlocked, the script wouldn't be able to lock the bootloader again without an OEM lock being done.
I noticed some discussion earlier in the thread about having users manually go back to OEM locked after installing BootUnlocker.
I wonder now if we might have an additional avenue to try? Instead of having users manually go back to OEM locked, what about trying to have the script attempt to reflash the data to unlock again before attempting to lock?
What I have in mind is having the script change the bootloader unlock state from OEM unlocked to script unlocked and therefore be able to use the script to relock and avoid the need for the user manually doing an OEM lock.
I haven't had time to really look at the script that
@osm0sis posted upthread but I could try to modify it to test this concept. I may need assistance with this if I get stuck but I'm not afraid to at least try it before asking for help from you all.
I am by no means proficient with this so if anyone thinks I'm on the wrong track, or you've already been down this avenue with other devices without success, let me know.