LOUISVILLE, Ky. (WHAS11) — In the case of a fire, is it safer to sleep with the doors open or closed? Your answer can determine whether you make it out alive.

A dramatic video of a fire demonstration is spreading across social media this week, leading many people to rethink their sleeping habits. The 'Close Before You Doze' campaign was created by the UL Firefighter Safety Research Institute, a non-profit which studies and trains both firefighters and the general public on fire safety.

It asked a group of strangers, who slept with the door open. All but two raised their hands. Then, they walked through a training site, simulated to look like a home, with multiple bedrooms.

RELATED: Comparison of Modern and Legacy Home Furnishings (via Firefighter Safety Research Institue)

"About 40 years ago, you had 17 minutes to get out of your house once your smoke alarm sounded. Now, you have less than 3," Stephen Kerber, the director of UL FSRI said.

They left the 'home' leaving one bedroom door open and the other closed. Minutes later, a fire ignited in the family room.

The group watched as the smoke and flames chased down the hall to the bedrooms. Firefighters extinguished the fire a few minutes later revealing the difference between the two bedrooms. The one with the door closed - almost untouched. The one with the door open - blanketed in heavy smoke and soot. The difference between life and death.

It's a message local firefighters have preached for years.

"Fire needs what humans need, that's heat, oxygen and fuel," said Sgt. Justin Ames, with the Jeffersonville Fire Dept. "Fire wants to do what we want to do, we want to get out of the structure. So does the fire, because that's where the fresh air is. It's important to shut the door, because you're cutting the oxygen supply off to the fire and it's going to die down."

MORE: The Battle After the Blaze: An invisible threat turning deadly for firefighters

Sgt. Ames says closing the door can save your life as well as your neighbors'.

"Not only that, it makes it safer for a firefighter to go into these structures and fight these fires when the doors are shut," Ames said.

It's an important reminder for people living in apartments or duplexes. If you run from a fire and leave the doors open, you're allowing the fire to spread to the many units above you.

Firefighters urge everyone to have working smoke alarms on every level of your home, in and outside of bedrooms. Have an escape plan and if you can't get out quickly, that closed door is critical to your survival.

In Louisville, citizens who live in owner-occupied single family dwellings may request a home inspection through MetroCall 311. The Division of Fire will send a Fire Company to perform a voluntary home fire safety inspection and install a free ten-year lithium battery-operated smoke detector in the home if needed.

Note: Smoke detectors in rental properties must be provided by the property owner.

►Contact reporter Brooke Hasch at bhasch@whas11.com. Follow her on Twitter (@WHAS11Hasch) and Facebook.