diff --git a/core/src/main/golang/tun/tun.go b/core/src/main/golang/tun/tun.go
index 9ae7d2bb6e3e0dab6ea13dd271b2fc62636251b0..68d6932d3b461b27706645e35763809143b59d1e 100644
--- a/core/src/main/golang/tun/tun.go
+++ b/core/src/main/golang/tun/tun.go
@@ -72,6 +72,8 @@ func Start(fd, mtu int, dns string) error {
 	go func() {
 		// lwip tcp
 
+		defer stack.TCP().Close()
+
 		for {
 			conn, err := stack.TCP().Accept()
 			if err != nil {
@@ -94,6 +96,8 @@ func Start(fd, mtu int, dns string) error {
 	go func() {
 		// lwip udp
 
+		defer stack.UDP().Close()
+
 		for {
 			buf := allocUDP(mtu)