[LWJGL3/OpenGL] New window mode versus VAO

I’m making use of a VBO inside of a VAO to keep track of many updating verts. I’m working on the ability to change window modes. These windows are through GLFW as it is with LWJGL3.

If I’m changing window modes, as I understand it, I need to destroy the window to go from fullscreen => window => window borderless. When I do this, my VAO seems to get damanged.

I get this error after destroying window:

Message: GL_INVALID_OPERATION error generated. VAO names must be generated with glGenVertexArrays before they can be bound or used.

I don’t believe I run an action that should harm the VAO here, but sure enough it is pist.

I will provide how I’m setting up my VAO (and VBO) if nothing else than as a point of reference if you can help. I’ve researched, but I’m struggling with the proper terms or concepts to find the right information.

VBO Setup:

public void setupVBO()
    {
    	/* Get width and height of framebuffer */
        long window = GLFW.glfwGetCurrentContext();
        IntBuffer widthBuffer = BufferUtils.createIntBuffer(1);
        IntBuffer heightBuffer = BufferUtils.createIntBuffer(1);
        GLFW.glfwGetFramebufferSize(window, widthBuffer, heightBuffer);
        int width = widthBuffer.get();
        int height = heightBuffer.get();
        
        /* Generate Vertex Array Object */
        vao2 = new VertexArrayObject();
        vao2.bind();

        elements = BufferUtils.createIntBuffer((2*adjacentNodesNum) * 3); //2 * 3
        
    	for(int i = 0; i < adjacentNodesNum; i++)
        {            
    		
            elements.put((i*4) + 0).put((i*4) + 1).put((i*4) + 2);
            elements.put((i*4) + 2).put((i*4) + 3).put((i*4) + 0);
        }  
    	
        //vertices.flip();
    	myFloatBuffer.flip();
        elements.flip();

        /* Generate Vertex Buffer Object */
        vbo2 = new VertexBufferObject();
        vbo2.bind(GL_ARRAY_BUFFER);        
        vbo2.uploadData(GL_ARRAY_BUFFER, myFloatBuffer, GL_DYNAMIC_DRAW);

        /* Generate Element Buffer Object */
        ebo2 = new VertexBufferObject();
        ebo2.bind(GL_ELEMENT_ARRAY_BUFFER);
        ebo2.uploadData(GL_ELEMENT_ARRAY_BUFFER, elements, GL_DYNAMIC_DRAW);

        /* Load shaders */
        vertexShader2 = Shader.loadShader(GL20.GL_VERTEX_SHADER, "resources/shadProg.vert");
        fragmentShader2 = Shader.loadShader(GL20.GL_FRAGMENT_SHADER, "resources/shadProg.frag");

        /* Create shader program */
        program2 = new ShaderProgramSr();
        program2.attachShader(vertexShader2);
        program2.attachShader(fragmentShader2);
        program2.bindFragmentDataLocation(0, "fragColor");
        program2.link();
        program2.use();

        specifyVertexAttributes();

        /* Set texture uniform */
        int uniTex = program2.getUniformLocation("texImage");
        program2.setUniform(uniTex, 0);

        /* Set model matrix to identity matrix */
        Matrix4f model = new Matrix4f();
        int uniModel = program2.getUniformLocation("model");
        program2.setUniform(uniModel, model);

        /* Set view matrix to identity matrix */
        Matrix4f view = new Matrix4f();
        int uniView = program2.getUniformLocation("view");
        program2.setUniform(uniView, view);

        /* Set projection matrix to an orthographic projection */
       Matrix4f projection = Matrix4f.orthographic(0f, width, height, 0f, -1f, 1f);
        int uniProjection = program2.getUniformLocation("projection");
        program2.setUniform(uniProjection, projection);
        
        vao2.unbind();
        vbo2.unbind(GL_ARRAY_BUFFER);
        ebo2.unbind(GL_ELEMENT_ARRAY_BUFFER);

        glUseProgram(0);
        
    }

Thank you! ;D