Surfaces of AlN epitaxial layers grown by molecular beam epitaxy (MBE) in continuous mode were analyzed by means of X-ray photoelectron spectroscopy, atomic force microscopy and reflection high-energy electron diffraction without breaking the ultra-high vacuum. Our studies show the presence of the Al-Al and N-N bonds on the AlN samples, as well as a rather rough 3D-like structure. Significant improvement of the surface quality was achieved by employing a low flux Al deposition in pulsed mode at the end of the MBE growth (still under a nitrogen background pressure). Subsequently, on the obtained AlN buffer layers, Al0.85Ga0.15N/GaN multiple quantum wells (MQWs) were grown to show the influence of the buffer layers quality on the entire structure properties. The photoluminescence studies indicate that the introduction of pulsed low flux Al deposition improves optical properties of the grown MQWs layers, i.e., the relative intensity between the QW emission and the low energy emission is clearly in favor of pulsed Al deposition.