Fixes thread-safety for @id variable

I think this fixes the issue that I reported in #11. I haven't put a lot of time into it, but this should fix the thread-safety issue with the `@id` variable. I'm not sure if the other variables need to be protected too. The way I use `KM`, I set it up once with `KM.init()` in an Rails initializer and call `KM.identify` and `KM.record` in the controllers. There might be more thread-safety issues for other use cases.