Update main.py

Adding "with:" clausules to close calls to "already_published" file avoiding corruption.
Merge pull request #2 from dinnouti/patch-1

Update main.py