I'd put a timer in for both see person and close door... If see person 0.25s open door, if no see person for 10s close door... The timer values would have to be played with, but that would keep the door from opening for junk signals and closing on people as they walk through. Of course then you have all the saftey stuff like a sensor for person in doorway, don't close door and door close motor over current, doorway jammed, don't close door...