fixed closing connection