Cleanup link_states and fix a rare highlight bug

Found how to reproduce the bug which was unsolved in #485: @chrox was right, there was some cleanup missing. Also fix a rare highlight bug which got me a crash yesterday:
```
./luajit: ./frontend/ui/reader/readerhighlight.lua:300: attempt to index field 'hold_pos' (a nil value)
stack traceback:
	./frontend/ui/reader/readerhighlight.lua:300: in function 'lookup'
	./frontend/ui/reader/readerhighlight.lua:320: in function 'handleEvent'
	./frontend/ui/widget/container/widgetcontainer.lua:63: in function 'propagateEvent'
	./frontend/ui/widget/container/widgetcontainer.lua:75: in function 'handleEvent'
	./frontend/ui/uimanager.lua:119: in function 'sendEvent'
	./frontend/ui/uimanager.lua:307: in function 'run'
	./reader.lua:196: in main chunk
	[C]: in function 'dofile'
	./koreader-base:37: in main chunk
	[C]: at 0x0000c604
```