Fix edge cases on closing/opening links ui