Add connection close block

See

http://stackoverflow.com/questions/13675879/activerecordconnectiontimeouterror

If you're using the Thin server, in threaded mode, then you need to add
this to your Sinatra app:

after do
  ActiveRecord::Base.connection.close
end

The reason is that Thin splits the request processing over 2 threads and
the thread that is closing the ActiveRecord connection is not the same
as the thread that opened it. As ActiveRecord tracks connections by
thread ID it gets confused and won't return connections correctly.