Bootloader does not stay locked
My stock, un-rooted, Nexus 4 decided to stop working today. It just got stuck at the X loading over and over again. I'm trying to flash a recovery and fix this, but I can't get the bootloader to unlock. I type in fastboot oem unlock, which gives me the option to unlock. As soon as I reset however, it becomes locked again automatically.
I've also tried flashing recover right after unlocking, but it gives me an error and says remote: flash write failure.