added close() stuff