End session when clicking outside
Check index before trying to open a link