public Status Finish() {
		Flush();
		assert (!rep_.closed);
		rep_.closed = true;
		BlockHandle metaindex_block_handle = new BlockHandle(); // dummy
																// currenly
		BlockHandle index_block_handle = new BlockHandle(); // TODO
		if (ok()) {
			BlockBuilder meta_index_block = new BlockBuilder(rep_.options);
			// TODO(postrelease): Add stats and other meta blocks
			WriteBlock(meta_index_block, metaindex_block_handle);
		}
		if (ok()) {
			if (rep_.pending_index_entry) {
				rep_.last_key = rep_.options.comparator.FindShortSuccessor(rep_.last_key);
				byte[] handle_encoding = rep_.pending_handle.EncodeTo();
				rep_.index_block.Add(new Slice(rep_.last_key), new Slice(
						handle_encoding));
				rep_.pending_index_entry = false;
			}
			WriteBlock(rep_.index_block, index_block_handle);
		}
		if (ok()) {
			Footer footer = new Footer();
			footer.set_metaindex_handle(metaindex_block_handle);
			footer.set_index_handle(index_block_handle);
			byte[] footer_encoding = new byte[0];
			footer_encoding = footer.EncodeTo(footer_encoding);
			rep_.status = rep_.file.Append(new Slice(footer_encoding));
			if (rep_.status.ok()) {
				rep_.offset += footer_encoding.length;
			}
		}
		return rep_.status;

	}