Air purifiers will still work while windows are open in your space, however, the purifier will greatly reduce its efficiency because outside elements will be repeatedly pulled in.
If your windows are closed, the room's own air will be repeatedly circulated meaning any present contaminants will quickly be removed.