Fix context shutdown

This pull request allows the GL context to be shutdown cleanly.

First it adds View::make_inactive() which is called just before the rendering thread terminates to clear the GL context from the thread. This is needed to ensure the GL context will be deleted properly.

Second it adds Map::terminate() which is to be called before destroying a GL context to ensure any GL resources held by Map are released. It is synchronous and uses the calling thread to make the GL calls.

Map::terminate() allows an application to destroy and recreate the GL context as needed without having to first delete the Map object. This is needed on Android as the GL surface can be destroyed without closing the app.

Fixes #340 and #341.