fixed issues with closing price data.
Modified some checks and parameters for more efficient selection.