Add dangling hook reference check

Normally, the case is not occurred. (So I couldn't add a test for the
case. :<) It makes groonga more robust.