If you use CalMag just make sure you are doing salt maintenance. This is an important nute when growing hydroponically or in a soilless medium but less important when growing in soil.
Nitrogen is needed by plants to produce chlorophyll, proteins, amino acids and other important biological compounds. This is used by your plant to grow her stem, leaves and branches in veg. The yellowing is a normal occurrence as nitrogen is not used by the plant when in late flower-- she isn’t focused on the green stuff anymore, she just wants to build her buds.