Move handle checking code to copychunk_check_handles().