In situ electron microscopy study of structural transformations in 2D CoSe2