Nanoscale observation of photoinduced domain pinning and investigation of imprint behavior in ferroelectric thin films