Sorting by key + *file*.close()