This is typically caused by a mounting issue. Please check the following:
Verify that the notches on both pieces are directly across from each other
Check to ensure the sensors are no further apart than 3/4" (the closer the better)
Check to ensure both sensors are flush with one another, no recess in the door or frame and on the same plane.
Ensure there is no play (movement) in the door or window when it is closed.