The irrational act isn't locking the fridge, it's snacking at midnight--you gain weight, use up food, and get less sleep.
You don't have to result in locking up your food at night, just stop eating during that time.