fixing random crashes caused by race condition

I've experienced random crashes whenever the app becomes deactive. `UAAnalyticsDBManager` wanted to write a session asynchronously that already might have been released in main thread.

Also, slightly modified fix df60f2e96fb60931c096034e47234c20fef0d8f6 to replace `retain` with `copy` for `deviceToken` as stated in property declaration.