`unexpected keyword_end` when using `wrap_layout`

I have a default layout and I want to use nested layouts but keep running into an error with HAML.

I have a limited test case with the following:

# source/layouts/layout.haml
!!! 5
%html
  %head
  %body{ class: page_classes }
    = yield
# source/layouts/car.html
- wrap_layout :layout
  = yield

I end up with the following error:

Haml::SyntaxError at /cars/test-car
layouts/car.haml:3: syntax error, unexpected keyword_end, expecting end-of-input ));}\n", 0, false);end;;_erbout ^

Ruby	/usr/local/var/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/haml-4.0.7/lib/haml/engine.rb: in rescue in render, line 131

Here are the contents of my Gemfile:

# If you do not have OpenSSL installed, change
# the following line to use 'http://'
source 'https://rubygems.org'

# For faster file watcher updates on Windows:
gem 'wdm', '~> 0.1.0', platforms: [:mswin, :mingw]

# Windows does not come with time zone data
gem 'tzinfo-data', platforms: [:mswin, :mingw, :jruby]

# Middleman Gems
gem 'middleman', '>= 4.2.1'
gem 'middleman-minify-html'
gem 'middleman-deploy', '~> 2.0.0.pre.alpha'

gem 'redcarpet'

And my config.rb file:

# Read from Gulp Starter's config.json file
# and rev-manifest file (if present)
require 'lib/gulp'
require 'lib/package'

# page '/*.xml', layout: false
# page '/*.json', layout: false
# page '/*.txt', layout: false

# Pretty URLs
activate :directory_indexes

# Language Support
set :haml, { :attr_wrapper => '"', :format => :html5 }
set :markdown, fenced_code_blocks: true, smartypants: true
set :build_dir, "public"

# Markdown options
set :markdown_engine, :redcarpet
set :markdown, :tables => true, :autolink => true, :gh_blockcode => true, :fenced_code_blocks => true, with_toc_data: true

# Deploy
activate :deploy do |deploy|
  deploy.deploy_method = :git
  deploy.build_before = true
end

I’ve tried with plain erb and get an error stating that my template car can’t be found.
This makes me think that wrap_template is not available out of the box.