Gold declines 0.4%, sealing first monthly loss since May