[2.7] NEXUS-6156: Deleted files left after optimize

Squashed and backported to Nexus 2.7.x

Original PR
https://github.com/sonatype/nexus-oss/pull/278

Commits
b1a1d5e9f18a1297b462d1d2061944370cea3770
934c1f00789195cdf0011be3640fae453f6f8f2c

CI
https://bamboo.zion.sonatype.com/browse/NX-OSSF17