Convert the re module over to the LuaJIT ffi
Ensure the lua state gets closed when running tests

This is required for the gc metamethods to actually get run.
Remove the automation thread priority stuff

It hasn't actually been used for anything for a while, and if a single
normal-priority thread can make your system unresponsive it's time to
upgrade to an OS that's isn't garbage.