The conditions of chondrule formation, Part I: Closed system