out.close();
if (error) { fmos.abort(); try { out.close(); } catch (IOException e) { } }
	public void saveMetaData() {		// the cache and the state match		if (!canWrite() | timeStamp == stateManager.getSystemState().getTimeStamp())			return;		File metadata = null;		try {			metadata = File.createTempFile(LocationManager.BUNDLE_DATA_FILE, ".new", LocationManager.getOSGiConfigurationDir());//$NON-NLS-1$			DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(metadata)));			try {				out.writeByte(BUNDLEDATA_VERSION);				out.writeLong(stateManager.getSystemState().getTimeStamp());				out.writeInt(initialBundleStartLevel);				out.writeLong(nextId);				Bundle[] bundles = context.getBundles();				out.writeInt(bundles.length);				for (int i = 0; i < bundles.length; i++) {					long id = bundles[i].getBundleId();					out.writeLong(id);					if (id != 0) {						BundleData data = ((org.eclipse.osgi.framework.internal.core.AbstractBundle) bundles[i]).getBundleData();						saveMetaDataFor(data, out);					}				}			} finally {				out.close();			}			fileManager.lookup(LocationManager.BUNDLE_DATA_FILE, true); //the BundleData file may not have been created at this point.  			fileManager.update(new String[] {LocationManager.BUNDLE_DATA_FILE}, new String[] {metadata.getName()});		} catch (IOException e) {			frameworkLog.log(new FrameworkEvent(FrameworkEvent.ERROR, context.getBundle(), e));			return;		}	}