Fixed file leak caught by cppcheck