diff --git a/lib/rack/app/singleton_methods/route_handling.rb b/lib/rack/app/singleton_methods/route_handling.rb
index <HASH>..<HASH> 100644
--- a/lib/rack/app/singleton_methods/route_handling.rb
+++ b/lib/rack/app/singleton_methods/route_handling.rb
@@ -57,8 +57,8 @@ module Rack::App::SingletonMethods::RouteHandling
     @namespaces ||= []
     @namespaces.push(request_path_namespace)
     yield
+  ensure
     @namespaces.pop
-    nil
   end
 
 end
refactor: move namespace pop part to ensure block