fix close on exception