First, if you are using a Microphone to record, then you need to make sure that it is the selected and ONLY selected device for Windows. The method for making that selection is dependent on what version of Windows you are using.
Second, if you are selected for recording microphone, and the microphone is too close to the speakers, then you are recording the playback through the microphone. This would cause massive distortion and would get progressively worse over time.