Removing duplicate entries from file