Prevent scheduler and db threads from blocking exit