"Will OOP close any positions opened previously, but not in the optimal portfolio list today?" Yes, any currently held securities not selected by the 'order_optimal_portfolio' method will be closed. Or, more specifically, a market order will be placed in an attempt to close any existing positions (ie sell any long positions / buy any short positions). Existing open orders are also included in determining the quantity of shares to order.
"From your previous post, looks like the algo will have to close these manually using order_target_percent since objective function will include all the Q1500US stocks". No. One never needs to close any positions 'manually'. The correct way of thinking about 'order_optimal_portfolio' is that it first determines a 'desired state' of securities and associated weights which meet the objective and all the constraints. Next, it sums the current positions and any currently outstanding orders to get a 'current state' of securities and associated weights. Finally, it simply places all the orders necessary to move the portfolio from the 'current state' to the 'desired state'. If a currently held security is not in the 'desired state' then the method will attempt to close the position by placing an order equal to the current shares less any currently outstanding ordered shares.
One important point. Just because a security is in the set of securities given to the objective function (say all Q1500US securities), that alone doesn't require the optimize method to include all those securities in the optimized 'desired state'. An 'optimal' solution meeting the objective and all constraints may be only a sub-set of the Q1500US. It could also actually be a larger set and include some securities NOT in Q1500US if they were specified somehow in a constraint. The point to remember is that the optimize function simply determines a 'desired state' of securities. Any securities not in that desired state are closed.