added ifstream.close()