Optimality of D-policies for an M/G/1 queue with a removable server