Fix memory leak and probably TLB shootdown livelock
The script included in #154 (closed) runs for at least 10 minutes on my machine (probably infinite, as I've found no traces of additional leaks from the virtual memory system), whereas it crashed after just a few seconds before this change.
The livelock bjorn3 found is probably very rare, so it's hard to prove this fixes it, but the "two threads are waiting for each other" scenario should be handled anyway.