Always make sure that each cavern access is individually sealable. Do NOT seal it such that you seal yourself off from the rest of the downstairs and allow whatever you were locking out full access to the stairwell below.
The easiest and most effective way to do it is with hatch covers. Put a hatch on the stairs going into the cavern, making sure that the continuing downward stairwell to the next cavern is above the hatch. Hatch covers can not be destroyed from underneath, so forbidding passage will stop anything in the game, and can be done instantly without waiting for a dwarf to pull a lever. You may consider this a bit of an exploit, and frankly it is. If you prefer, you can link the hatch to a lever, or us a bridge instead, to do the same thing but with a slower, somewhat unreliable response time.
Once you have breached the cavern in a sealable way, look for a good spot to secure. You want a wide flat area with trees and plants, ideally without too many pillars blocking things, because those would have to be muddied with water to grow anything after they are mined out. Ideally, the area will only have map edge access at a few easily walled off choke points. Wall all of those off, potentially leaving a drawbridge or something else if you want through later. Don't forget to extend the walls up to the ceiling to block flyer access at some point, although that can be left until after you've started chopping wood if you want. Water can be hazardous, since giant olms, cave crocodiles, and assorted other nasties can come out of it. Seal it off unless you can completely enclose it.
Generally, I'm much less cautios than this, and if I want wood NOW, I just charge straight in and cut some, keeping a close eye on the (u)nit screen in case anything wanders by, and worry about walls and sometimes even the initial hatch later, once my dwarves have beds and wheelbarrows. This usually works, but
sometimes ends in disaster. I would recommend at a bare minimum putting a hatch or bridge to seal off the cavern before making connection with the cavern floor. It helps to have the hatch built before you start looking for the cavern (I usually don't).