added close() handler