you can do that with normal barriers, since barriers have option to be locked when a bool returns true ( for you, !npc_has_done_their_thing because your bool returns true when you want the door to be unlocked, so you need to reverse that)
Than you just need to set that bool to true when the NPC is done, or to check if the NPC is present in the room and then set it to false, and to true when they are not present.