NEW YORK (CBSNewYork) — The FDNY says Sunday’s deadly Bronx apartment building fire was caused by a malfunctioning space heater in a bedroom.

Making things worse, it said an apartment door was left open despite it being a self-closing door. That allowed toxic black smoke to drift throughout the building.

If a fire broke out in your apartment building, would you know what to do?

READ MOREBronx High-Rise Fire: What To Do If You Were Impacted & How To Help Survivors

At the FDNY Fire Zone in Midtown, adults and children learn what to do in a fire emergency through a simulated fire scene. CBS2’s Alice Gainer saw one involving a space heater.

“Any kind of item that heats or cools has to be plugged directly into the wall. A space heater needs space. Three feet around a space heater should be free of anything combustible,” FDNY Capt. Michael Kozo said.

The FDNY says to never leave it unattended and to turn it off when you go to bed. Only use one that has the Underwriters Laboratories (UL) mark showing it has been safety tested.

(Photo: FDNY)

To be prepared in case of fire, Kozo said to have an escape plan, adding that starts with knowing what kind of building you live in — fireproof or non-fireproof.

“It will be posted in the lobby or you can check with the Department of Buildings,” Kozo said.

READ MORERed Cross Helping Families Displaced By Deadly Bronx Fire, Borough Leaders Set Up Task Force To Assist Survivors

If you’re in a non-fireproof building, “You have to get out of that building, because the fire can spread from one apartment to the next,” Kozo said.

If you’re in a fireproof building, “and the fire is not in your apartment, it is usually safer to stay inside your apartment rather than try to escape,” Kozo said. “Put duct tape around the door frame. You could take a damp towel and shove it underneath the door just to prevent that smoke from coming in. They are made to contain the fire in the portion of the building it started in.”

Regardless of the type of building you live in, fire officials say it’s important to always remember to close the door behind you when you leave.

“Try and isolate the fire as much as you can by closing as many doors as you can,” Kozo said.

PHOTOSPhotos: On The Scene Of Deadly Fire At Bronx Apartment Building

Because if you don’t, and the fire is in your apartment, “The smoke and the heated gases and everything escape from that fire apartment and now begin to contaminate the rest of the building. It will contaminate that fire floor and once somebodyopens that staircase door it’s gonna go right into the staircase and it’s going to shoot straight up the building.”

“You can prevent that fire from spreading and harming others. Close the door,” he added.

Every year, apartment residents are mailed a fire emergency preparedness guide. Make sure you read it and always call 911.

Alice Gainer