Freeze-dried formulations including nanoparticles and methods of freeze-drying