fixed closing errors