Prevent shutdown race, and refuse new requests.
Merge pull request #92 from mredivo/shutdown-race-2

Prevent shutdown race, and refuse new requests.