I think deepak is explained well except one part enumerated below:
financial accounts prepared for accounting period normally of 12 month.
Suppose new business starts and obvious there is no stock. then first year trial has neither opening stock nor closing stock. And why Closing stock not expensed in 1st year for matching principle concept.
iind year stock carried forward and thus included in trial balance as per accounting formula ie capital+liabilities=assets+properties. and current year closing stock already included in purchases thus not separately shown in trial balance.