The law is generally not sympathetic to such drastic action, even though its motive is understandable.
Under JCT Standard Building Contract 2009, the contractor is legally permitted to issue a 7-day written notice under clause 4.14 and then to suspend duties should it not receive satisfactory payment. Alternatively, a contractor can issue a default notice prior to termination. This is dealt with by clause 8.1.1.