I found this today when someone posted a link to it earlier and I was like "HOLY CRAP IT'S WHAT I'VE BEEN LOOKING FOR!" and then tried it and it works! Basically it's a way to customize the lock screen so it locks when you want and gives you way more control over it instead of what is in our Settings menus.
(UPDATED 17-10) Auto Lock (CSDEVCTRL) - xda-developers
I just thought I would share my discovery. It's a little complicated to figure out at first but basically you want to make sure you set the hard lock. The way I have it configured is that when my device wakes up it locks the screen which is handy.