Remove PhysicsManager singleton and use shared_ptr instead.

Resolves the issue where sometimes destructors were called in an unexpected sequence resulting in a crash while exiting the application.

Note: document may not be the most logical place put the physics system, but there is a need to associate a physics system with a document.  An alternative is to keep a map in viewmanager, but of course doing so makes it more complex (i.e. many objects have access to document but not viewmanager or view).