Kid keeps leaving

My 4 year old keeps leaving the house if he sees me busy doing anything like laundry or on the potty etc. we don’t have anyone around us but family but I am Afraid he will go in the woods and get lost or something because he tries to hide once he’s out I’ve talked to him about how bad and dangerous it is I’ve took things etc. and it’s not working so what are some things I could use to help prevent him from leaving the house ? Also what could I use in his bedroom he still sleeps in my bed because I am afraid he will leave his room while I’m asleep