Actually - it should work either way, but your last version will be leaving the IR LED ON if the cathode is connected to GPIO.2.