Flatness results for nonlocal phase transitions