Which method are you using to flashing back to stock?
If you're using a rom that's the same ver/firmware as the stock ( LJ7 ) back up your apps using Titanium Backup root on the custom rom.
Back up the files to a PC / Dropbox / FTP etc.
Re-do the flash method back to stock.
Go into the stock recovery, and do a hard wipe / data reset / cache.
Reboot the phone /- download Titanium Backup from Play Store to restore your apps back
install a custom recovery re-wipe Cache and Dalvik Cache and then reboot system two times after that.
First reboot for optimizing apps, then a 2nd reboot to make sure the phone / apps are optimized.
The method i used was QBKing's unroot and restore softbrick method to go back to Stock
re-root it manually using TeamEpic's CWM and root from Restore by TeamEpic and then reflashing recovery for twrp 2410.
If you're still having issue's via Odin flashing to stock
try a dif mini usb plug, try a dif USB port on your PC and have your PC's sleep mode turned OFF.
Try uninstalling your samsung drivers ( using an advanced uninstaller application that also removes left over files )
and re-installing them.
These are basic troubleshooting methods because it might be hardware error / port busted / wrong cable type / Drivers error
that can cause issues when restoring to stock.
Hope this info helps.
If restoring to LJ7 fails try restoring all the way back to ICS 4.0.4 and updating to LJ7.
And if both fails.
Someone with better experience as me can reply to this thread to help try fixing your issue.
SPH-L710 - Stock De-Odexed LJ7\MA6\MB1 // 4.1.1\4.1.2
ROM Used - Light Jelly 1.2
Powered by K747 4.1.1\4.1.2 On Ghost Optimizations for Battery Life
REC: TWRP 22.214.171.124
Serenity G-Note II TB3 Port / K747 4.1.1 on JackHamster's Optimizations for Battery Life + Performance