The linkClicked variable has a scope of just this function, and is temporarily set true to signal that the link was clicked, rather than the user clicking outside the modal. It is then reset to false, though this may be unnecessary, it helps to get across the purpose of the variable. 

This fixes the issue of Modals popping up after you close one, and assuming you're okay with how the code's written should be okay for a merge.