Refactorization of compress_files

This may have been causing problems when compressing files, as I was using the word _file_ as filename. Also I use the with statement to open the files now