Fix #198 improve shutdown handling with respect to asynchronous close() calls that might be occurring.