A strange problem

Hi! For some time i write a simple Game Engine in C++ and Vulkan. Today, i want to write some code from this part of Intel Tutorial(Section “Image Presentation”):

But i encountered a strange problem: a main loop performs only 3 times. Please help!
Here is a repo of simple engine:

While developing have the Vulkan validation layers enabled.

Okey, now validation layers display that problem : “Swapchain(ERROR): object: 0x56fbfb0 type: 3 location: 1037 msgCode: 4: The surface in pCreateInfo->surface, that was given to vkCreateSwapchainKHR(), must be a surface that is supported by the device as determined by vkGetPhysicalDeviceSurfaceSupportKHR(). However, vkGetPhysicalDeviceSurfaceSupportKHR() was never called with this surface.”. When i write this function, Visual Studio throws memory leak. Please help!

Thanks, @KrOoze! Without you i will never repair this bugs! I do many mistakes but i just patched them, and all working Thanks!