My Macbook Pro's headphone jack is buzzing/humming I have an audio problem with my new macbook pro 2017.

If there is an audio playing my headphone jack starts to buzz (headphones unplugged). When I stop playing audio, after a short period of time, it stops humming. When I plug the headphones and start playing the audio, headphone jack is not buzzing/humming. This is super weird. It looks like macbook for some reason thinks that it has plugged headphones even when it doesn't

Does anyone know how to deal with this problem?
Ok, I have fixed this problem by reinstalling the OS.