Revert "move setting lastCompactedKey to before the return-if-nothing-added"

This reverts commit f3dc188e203b3db980ee81df05390968043cb601.