Shane Bauer and Josh Fattal who had been given eight-year jail terms by Iran for spying have been released on bail.