Solved the file leak problem