Reorder sleep to handle fast exits. Fixes #79