The headless client plugin has manages its own client ids, these are not the same as the internal client id which is displayed on the admin page.
You can get a handle to the client using the getClientID() method
var client = plugins.headlessclient.createClient(solutionName,username,password,solutionOpenMethodArgs);
var clientHandle = client.getClientID();
...
client = plugins.headlessclient.getClient(clientHandle);
Rob