Fixed *_detach cleanup issues

- ro->* were being updated before urt_deregister, but they were not
  being protected by a lock.  I now pass those parameters to
  urt_deregister so that function updates those values while holding the
  lock.

Signed-off-by: Shahbaz Youssefi <ShabbyX@gmail.com>