My 2014 CX-5 had a problem (for years now), when I tried to shut it off the radio (accessories) would stay on. If you leave the car like this and shut the door it will NOT eventually shut off... it will drain your battery! Most people work around this by starting and stopping the car again but putting it in park forcefully... some times it takes several tries. In about 4 minutes I show you how I replaced the switch in the console that detects when the car is in park(among other things)... the Mazda part number is KDY0-46-040 I ended up ordering it on eBay (Could not find it on Amazon) it cost me about $65 (Ordered it in June 2018). I have had several comments that the Right Hand Drivers(RHD) part number is KDY1-46-040. I asked my Mazda dealer how much it would cost to fix this and they said $300-$400. I hope this helps someone save some money. I am not a mechanic, so I may have done something that mechanics would do differently... but it worked for me YMMV :-)
I found this link from Mazda: https://mazda.oemdtc.com/665/ignition-does-not-turn-off-when-pressing-startstop-button-2013-2014-mazda