Effects of topological boundary conditions on Bell nonlocality