Implementation of fault-tolerant quantum logic gates via optimal control