Remove string at the end of file