Add routines to clean up terra state
Merge branch 'terra-cleanup-code' of https://github.com/cbranch/terra
terra cleans up after itself when lua_close is called.