Real-time studies of the mechanisms of nanocrystal structural phase changes