I asusme that open and close are morph abilites of the gate?! then you could use a behaviour with a periodic issue order for the morph ability(open). the morphed unit has a similar behavior for closing. in addition the behaviors need Enumerate Area validators in the Disable field to compare if there are units nearby or in the case of close if there are no units. I dont know if it works (cant test right now), but you could try.