Close custom context menu after clicking on any item in it

Is it possible to close my custom context menu after clicking on any item inside it.

thanks.