add finally for close()