Nekrasov functions from exact Bohr–Sommerfeld periods: the case of SU(N)