Running main loop 2 times with conditional statement

I think you need to put wp_reset_postdata(); after your first endwhile; so that the loop can return to the start. Can see more about that function here: https://codex.wordpress.org/Function_Reference/wp_reset_postdata