Close context menu after clicking action.

Fixes #332