Modified resetFile() function to discart existing content