It‘s your Apple Smart Keyboard. I have a 9.7” Pro and I got the first keyboard replaced within warranty when the edges started fraying and it started chiming. The second one held up pretty well after that but the edges have again frayed and it chimes almost every time I open it close it.
In anticipation of the new Pros, I bought a new keyboard off of ebay so I can give this one to my wife and connected it to see if the problem continued. And the answer is... no. It’s fine and the iPad acts like the day I pulled it from the box.
I don‘t know exactly what part of the keyboard fails that causes this but my hunch is that it‘s the hinge. With the old one, the material feels loose and spongey compared to the tight weave of the “new” one.
On the upside, 9.7” ASKs are going for pretty good prices on ebay. Cheaper than when I bought my original one, anyway. It’s a shame Apple’s not making them any more. The device will probably be useable for at least another 3-4 years but I’ve never had a keyboard last longer than 18 months and, without one, the utility becomes more limited in my mind. But I finally bought my first iPad for the keyboard, so I‘m one of those people... My wife‘s utility will probably be different.