Check for gzip and bz2 modules

Sometimes, the gzip and bz2 modules are not present in a Python installation which leads to errors when importing the app layer.  This makes it so that an exception is thrown only when trying to write the zipped file (i.e. not at the import level).