diff --git a/briar-core/src/org/briarproject/messaging/duplex/DuplexConnection.java b/briar-core/src/org/briarproject/messaging/duplex/DuplexConnection.java
index 06d4758045befa69b465357ba3770f888866126e..56ec0aa93db900a8b507c83cab36b1e09a6147e5 100644
--- a/briar-core/src/org/briarproject/messaging/duplex/DuplexConnection.java
+++ b/briar-core/src/org/briarproject/messaging/duplex/DuplexConnection.java
@@ -223,6 +223,8 @@ abstract class DuplexConnection implements EventListener {
 			OutputStream out = createConnectionWriter().getOutputStream();
 			writer = packetWriterFactory.createPacketWriter(out, true);
 			LOG.info("Starting to write");
+			// Ensure the tag is sent
+			out.flush();
 			// Send the initial packets
 			dbExecutor.execute(new GenerateTransportAcks());
 			dbExecutor.execute(new GenerateTransportUpdates());
diff --git a/briar-core/src/org/briarproject/transport/OutgoingEncryptionLayer.java b/briar-core/src/org/briarproject/transport/OutgoingEncryptionLayer.java
index 0a4552f38a4f3fabd441162e51456a9fc3bcb2cb..a2c0036772af4452243119cea77dc78a1fba6f5a 100644
--- a/briar-core/src/org/briarproject/transport/OutgoingEncryptionLayer.java
+++ b/briar-core/src/org/briarproject/transport/OutgoingEncryptionLayer.java
@@ -63,9 +63,6 @@ class OutgoingEncryptionLayer implements FrameWriter {
 	public void writeFrame(byte[] frame, int payloadLength, boolean finalFrame)
 			throws IOException {
 		if(frameNumber > MAX_32_BIT_UNSIGNED) throw new IllegalStateException();
-		// If the initiator's side of the connection is closed without writing
-		// any data, don't write anything to the underlying transport
-		if(writeTag && finalFrame && payloadLength == 0) return;
 		// Write the tag if required
 		if(writeTag) {
 			try {
@@ -115,6 +112,17 @@ class OutgoingEncryptionLayer implements FrameWriter {
 	}
 
 	public void flush() throws IOException {
+		// Write the tag if required
+		if(writeTag) {
+			try {
+				out.write(tag, 0, tag.length);
+			} catch(IOException e) {
+				frameKey.erase();
+				throw e;
+			}
+			capacity -= tag.length;
+			writeTag = false;
+		}
 		out.flush();
 	}
 
diff --git a/briar-tests/src/org/briarproject/messaging/simplex/OutgoingSimplexConnectionTest.java b/briar-tests/src/org/briarproject/messaging/simplex/OutgoingSimplexConnectionTest.java
index df8087ab742700f1fbfd3da0ec4aa049ee09ff30..34184b59dbb0d739ccbcb31c54813816e92c0b36 100644
--- a/briar-tests/src/org/briarproject/messaging/simplex/OutgoingSimplexConnectionTest.java
+++ b/briar-tests/src/org/briarproject/messaging/simplex/OutgoingSimplexConnectionTest.java
@@ -140,8 +140,8 @@ public class OutgoingSimplexConnectionTest extends BriarTestCase {
 			will(returnValue(null));
 		}});
 		connection.write();
-		// Nothing should have been written
-		assertEquals(0, out.size());
+		// Only the tag and an empty final frame should have been written
+		assertEquals(TAG_LENGTH + HEADER_LENGTH + MAC_LENGTH, out.size());
 		// The transport should have been disposed with exception == false
 		assertTrue(transport.getDisposed());
 		assertFalse(transport.getException());
diff --git a/briar-tests/src/org/briarproject/transport/OutgoingEncryptionLayerTest.java b/briar-tests/src/org/briarproject/transport/OutgoingEncryptionLayerTest.java
index 3a3598f3fadb9afd948b789c777a13058c409775..d3a7746a1fa14370e42581ce8249d9d891a09344 100644
--- a/briar-tests/src/org/briarproject/transport/OutgoingEncryptionLayerTest.java
+++ b/briar-tests/src/org/briarproject/transport/OutgoingEncryptionLayerTest.java
@@ -75,8 +75,8 @@ public class OutgoingEncryptionLayerTest extends BriarTestCase {
 				FRAME_LENGTH, tag);
 		// Write an empty final frame without having written any other frames
 		o.writeFrame(new byte[FRAME_LENGTH - MAC_LENGTH], 0, true);
-		// Nothing should be written to the output stream
-		assertEquals(0, out.size());
+		// The tag and the empty frame should be written to the output stream
+		assertEquals(TAG_LENGTH + HEADER_LENGTH + MAC_LENGTH, out.size());
 	}
 
 	@Test