Fix race in background compaction check

patch by yukim; reviewed by krummas for CASSANDRA-7745