File handles issue and save(sorted)