Add Close function to lua
Fix release compilation errors