Fix issue with GAE and shutdown

See #189