Heat programming to improve efficiency in a batch freeze-drier