put connection close before log and inits