Why use windowing function instead of truncating the signal to integer amount of periods? According to this source of information if the signal is consisted of integer amount of periods then FFT would work ideally as if the signal was infinite in time. The same source mentions that windowing is not completely eliminating the spectrum leakage but just attenuating it. Therefore, my question is why perform windowing instead of truncating the signal to integer amount of periods, shouldn't the truncation to integer amount of periods give better results?
When an integer number of periods is known, truncation when followed by FFT (assuming periodicity) is equivalent to windowing it with a uniform window. Using another window may induce some leakage.

But, if your signal was sampled this way, this either means that you were very lucky, or that you already have a lot of knowledge about your signal. And thus that you have dmaller need for Fourier analysis.

The point of using specific windows is indeed to help analysis when periods are unknown.