Impact of nonideal cycles on the efficiency of quantum heat engines