Power Lock and Key Fob Issue

I have a 2008 Subaru Outback. Recently both key fobs stopped working completely (it’s not the batteries). At the same time, when you use the power locks, if any door is open it will lock and then unlock after about 1-2 seconds. There is also a door chime that dings whenever the drivers door is open like they key is still in the ignition even when the key is out. Any ideas how to fix this?

It sound like the switch inside the ignition lock cylinder that detects that a key is in the ignition is stuck. This is why the computer won’t allow you to lock the doors, it senses a key is in the ignition.