Enhance dedup logic to handle whitespace
Use defer right after the open/create to properly close the file
Merge branch 'release/v0.2.3'