Finding the Nearest Negative Imaginary System with Application to Near-Optimal Controller Design