Moving object reference out of the closure