Optomechanical state transfer in the presence of non-Markovian environments