A study of the near-infrared modulation at spin and orbital periods in the intermediate polar WX Pyx