The code above runs perfectly fine, the only problems I'm having is with sprites and texture, as soon as I add a sprite it shows the errors I pointed above, I don't understand what determines if the errors appear when closing the program or when opening, because I have 2 projects, same configurations: On one project I have the whole game, and the errors appear when it opens and sprites appear like boxes, and the 2nd project, where I have just 1 file with similar code as above except it also renders a sprite, but in that project the sprites appear normal and the errors are shown when closing the program.
Overall this behaviour is incredibly weird, I'm sure it's something really silly, but I can't think of even 1 thing I've done wrong, I just have no clue