How to hide empty staves?

Yes, you can switch on the ‘Allow individual staves of multi-staff instruments to be hidden’ option on the Vertical Spacing page of Layout Options.