fix memory leak in logging
close file handles