Replaced close() functions with a prototype