fix memory leak (3 lua_State were not being closed)
adding gitignore file with .swp
minor code style fix (two if-else using brackets)