1. adding locks to global devices and cm list
2. closing the devices monitor thread before removing devices

Signed-off-by: Eyal Salomon <esalomon@mellanox.com>