test: close server grafefully in http test

The test was calling server.close() without waiting for the server
to have received all the requests. This would cause an ECONNRESET.