Moved the serialization code where it belongs: front end

So the socket server serializes to JSON for instance, but other front-end
may do otherwise.
Added back 'close' to the API

...to make sure clients know about it
Added unit-tests that use an embedded KB
Improving 'end of life'

In particular, properly kill the subprocesses (classification and co)