This is due to there being a transaction or transactions having posted into a period later than at which point your wanting to close the Year End.
It is therefore mandatory that the Period End is carried out first for a period or periods which still contain posted transactions before the Year End can be carried out.
