diff --git a/opbeat/traces.py b/opbeat/traces.py
index <HASH>..<HASH> 100644
--- a/opbeat/traces.py
+++ b/opbeat/traces.py
@@ -253,8 +253,9 @@ class RequestsStore(object):
             yield
             return
 
-        transaction.begin_trace(signature, kind, extra, leaf)
-
-        yield
-
-        transaction.end_trace(skip_frames)
+        try:
+            trace = transaction.begin_trace(signature, kind, extra, leaf)
+            yield
+        finally:
+            if trace:
+                transaction.end_trace(skip_frames)
Make sure we always close traces.