Optical energy optimization at the nanoscale by near-field interference