private void writeToFile(
	                         final MultiProcessor executor,
	                         final Map<String, ByteClass> byteClasses,
	                         final List<Pair<ZipEntry, byte[]>> fileEntries,
	                         final BiMap<String, String> nameMaps,
	                         final BiMap<Signature, Signature> signatureMaps,
	                         final Map<Signature, Integer> flags
	                         ) throws
	                         IOException,
	                         FileNotFoundException,
	                         InterruptedException,
	                         ExecutionException
	                         {
		final Collection<Future<Pair<ZipEntry, byte[]>>> classWrites = newArrayList();
		for (final ByteClass clazz : byteClasses.values()) {
			classWrites.add(executor.submit(clazz.callable(signatureMaps, nameMaps, byteClasses, flags, correctEnums)));
		}

		FileOutputStream fileOut = null;
		JarOutputStream jar = null;
		try {
			jar = new JarOutputStream(fileOut = new FileOutputStream(output));
			for (final Pair<ZipEntry, byte[]> fileEntry : fileEntries) {
				jar.putNextEntry(fileEntry.getLeft());
				jar.write(fileEntry.getRight());
			}
			for (final Future<Pair<ZipEntry, byte[]>> fileEntryFuture : classWrites) {
				final Pair<ZipEntry, byte[]> fileEntry = fileEntryFuture.get();
				jar.putNextEntry(fileEntry.getLeft());
				jar.write(fileEntry.getRight());
			}
		} finally {
			if (jar != null) {
				try {
					jar.close();
				} catch (final IOException ex) {
				}
			}
			if (fileOut != null) {
				try {
					fileOut.close();
				} catch (final IOException ex) {
				}
			}
		}
	}