Bergdahl avoids prison, dishonorably discharged