Added automatic closing.