Delay removing physics until the document is closed.  Also other general cleanup.