Make shutdown be graceful, and adds a version with timeout

JAVA-75 #fixes