Semi-infinite cohomology ofW-algebras