in mx you dont have to do that - just click settings next to the layer selection in the link dialog and put in a tick in the "close popup layer automatically"

:-))