Open close windows

maybe this helps

see Calling processing sketches within a processing sketch