Numba Error with np.where()

Hi! I am trying to do MD simulations with periodic boundaries and seem to have errors with numba everytime I use this function:
@numba.njit
def check_boundaries(positions, L):
up, down= np.where(positions > L/2), np.where(-1*positions > L/2)
positions[up] -= L
positions[down] += L
return positions

def simulate(Ncube, T0, L, M, steps, h):
#N = Ncube**3
R = generate_fcc_positions(Ncube, Ncube, Ncube, 1.0, dtype=np.float32)[0]
V = generate_random_velocities(len(R), 3, T0, dtype=np.float32)
A = np.zeros((len(R),3))

K = np.zeros(steps)
E = np.zeros(steps)
Pos_history = np.zeros((steps, len(R), 3), dtype=np.float32)  
distance = np.zeros(steps)

for t in range(0, steps): 
    newEt  = calculate_potential_energy(R, L)
    E[t] = newEt
    F = calculate_forces(R, L)
    A = F/M
    newR = VerletNextR(R, V, A, h, L)
    newR = check_boundaries(newR[0], L) 
    Pos_history[t] = newR.reshape(3,-1).T
    
    newF = calculate_forces(newR, L)
    newA = newF/M
    newV = VerletNextV(V, A, newA, h)
    
    # update positions:
    R, V = newR, newV
    K[t] = kinetic_energy(V, M) 
return E, distance, V, Pos_history, K

Error:
/AppData/Local/Packages/PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0/LocalCache/local-packages/Python311/site-packages/numba/core/dispatcher.py:465)

     msg = (f"{str(e).rstrip()} \n\nThis error may have been caused "
     f"by the following argument(s):\n{args_str}\n")
     e.patch_message(msg) --> 
     error_rewrite(e, 'typing') 
     except errors.UnsupportedError as e: 
     # Something unsupported is present in the user code, add help info 
    error_rewrite(e, 'unsupported_error')