Compress all files
Currently the script assumes that it won't stop. When passes midnight, it closes the data file and compress it. But if for any reason the script stopped and multiple data files were created, only the one open when reaching midnght will be compressed, not the other ones. It is needed to compress all of them.