added safe closing for some finish problems