Official: Lewandowski to join Bayern at end of season