Recover soft bricked Nexus 4 using download mode
My nexus 4 is bricked and it all started with a bootloop. Although I can get into recovery mode, it doesn't let me flash anything and throws flash write failed errors for everything. Also when I boot into twrp recovery I get unable to mount /data, /system, /recovery, /cache errors for every action I perform. Formatting the partition also throws same errors. I have tried everything from reflashing factory ROM to CW11 ROM. In all probability it appears that the file system/partition table is totally corrupt and flash is unwritable. When I do fastboot oem unlock, it successfully unlocks the bootloader only until the next restart. After restarting, it is again locked, another sign that flash is unwritable. Now my only hope left is the download mode...please tell me how I can recover my phone using download mode or is there any other way.
Its been 4 frustrating days trying to resurrect my phone, all in vain. Please help!!