Effects of memory on spreading processes in non-Markovian temporal networks