fix race condition in file-server

Previously, multiple requests for the same .gen module could
cause the second request to delete the loaded module before
the first request had a chance to use it, causing a 500 error.