closing configurtion file correctly