fixed missing close() command for open file