Closed the ofstream in main.