If I ‘forget’ I’ve locked the chicken up (cos I often do it on autopilot) and go back down the garden later to lock her up, I have occasionally actually ‘let her out’ (even though it’s dark and she’s asleep), then realise what I’ve done and lock her up again! That’s an example of the same thing I suspect. If I’m on auto-pilot going down the garden to ‘sort the chicken’ I unthinkingly toggle between ‘lock the coop if it’s open’ and ‘open the coop if it’s locked’ regardless of what’s actually the appropriate thing to do!