Fixed logging close process