BulletSim: fix logic for enabling unmanaged code debug messages.
Free pinned memory when physics engine is unloaded.