I wonder if it could occur before the sound file is not actually over, but is silent to make it sound better (less abrupt). If there are a few frames where the sound hasn't ended yet, and the chest or your inventory is opened, it may trigger the sound again. Just a thought, and I don't mean to be annoying. I mean to be helpful.
I experienced this too, and it fixed when I changed the brightness in minecraft (from moody to bright).