Dont think it needs to be anywhere near as complex as that. The OP doesn't understand why they are getting more space to the right of the thumbnail sections when reducing the width of the browser, that's because they are mixing Bootstrap 3 and Flex - like half Float and half Flex, which tells me that's nuts.
I have no idea why the OP is using 3 Flex sections of 4 thumbnails (probably because of lack of understanding - obviously the 1st image in the 2nd section cannot move up to sit next to the last image in the 1st section, the 1st image in the 3rd section cannot move up to sit next to the last image in the 2nd section, hence also the huge gap to the right once the browser window gets narrowed.
This is a no brainer simple layout achievable with simple Flexbox. The question might well be why is the OP using Flexbox anyway as the layout can work perfectly ok without it just using the Bootstrap 3 float classes. The only thing Flexbox adds is its nice if the link buttons line up, plus if youre a bit of a code snob as I am its a better solution than using floats.
Why use a sledge hammer to crack a nut - I'm losing the will to live.....the whole web-development scene is packed full of 'nutty professors' who like to complicate the simplest of procedures.