Hi. If your closing stock has increased in value then you would debit 1001 and credit 5000. However if the closing stock has reduced in value you would credit 1001 and debit 5000.
There are no journals to do for opening stock as 1001 is a balance sheet code and the closing balance will automatically be carried over to the start of the new financial year in the year end process.