Eliminate extra newlines.

* No additional trailing newline after the last type in a file.
* No additional newline between package and types when there are no imports.
`if (!importedClassIndex.isEmpty())` ?