Refined the compaction process.

- Added lock files to make sure non-needed files are compacted at
  database startup.
- Removing failed compacted files at startup.
- Removing non-needed files at startup.
- Added new type of file: log and compacted.