added .close() functionality