Add terminate method to worker