logger: fix file leak