The pool deposit is refunded to the rewards address. Do not de-register the stake address before you get the deposit back.
Make sure to read Retire a stake pool tutorial
Copy cardano-cli stake-pool deregistration-certificate \
--cold-verification-key-file cold.vkey \
--epoch <future epoch> \
--out-file pool-deregistration.cert
Copy cardano-cli transaction build \
--testnet-magic 2 \
--tx-in $(cardano-cli query utxo --address $(cat payment.addr) --testnet-magic 2 --out-file /dev/stdout | jq -r 'keys[0]') \
--change-address $(cat payment.addr) \
--witness-override 2 \
--certificate-file pool-deregistration.cert \
--out-file tx.raw
Copy cardano-cli transaction sign \
--testnet-magic 2 \
--tx-body-file tx.raw \
--signing-key-file payment.skey \
--signing-key-file cold.skey \
--out-file tx.signed
Copy cardano-cli transaction submit \
--testnet-magic 2 \
--tx-file tx.signed