Added close() to constructor method