modify Close method