Hey, I am trying to run a test which uses both Android and iOS platforms, the test basically inputs something on Android app and then I am verifying the input is there on iOS, But somehow I am not able to continue the tests

I use quit to quit the driver on Android and then change platforms to iOS and then reinstantiate the diver for iOS. It works for a bit but then later on, the test fails stating that the Session ID is null, even though Appium server has successfully created a new session with unique ID. I donot
know why this is failing and why i am getting that session ID is null for Android driver, that i have closed and successfully started a new driver for Android. Any help would be much appreciated:

Logs:
Feb 24, 2017 3:27:28 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS

org.openqa.selenium.NoSuchSessionException: Session ID is null. Using WebDriver after calling quit()?
Build info: version: ‘3.0.1’, revision: ‘1969d75’, time: ‘2016-10-18 09:49:13 -0700’
System info: host: ‘garrys-MacBook-Pro.local’, ip: ‘10.5.5.24’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.12.3’, java.version: ‘1.8.0_112’
Driver info: driver.version: AndroidDriver
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:130)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:69)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteTimeouts.implicitlyWait(RemoteWebDriver.java:822)
at io.appium.java_client.pagefactory.AppiumElementLocator.changeImplicitlyWaitTimeOut(AppiumElementLocator.java:75)
at io.appium.java_client.pagefactory.AppiumElementLocator.waitFor(AppiumElementLocator.java:92)
at io.appium.java_client.pagefactory.AppiumElementLocator.findElement(AppiumElementLocator.java:103)
at io.appium.java_client.pagefactory.interceptors.InterceptorOfASingleElement.intercept(InterceptorOfASingleElement.java:57)
at io.appium.java_client.android.AndroidElement$$EnhancerByCGLIB$$c0b591f0.isDisplayed()
at com.parsable.cucumber.pages.mobile.LoginPageObject.isCurrentPage(LoginPageObject.java:100)
at com.parsable.cucumber.LoginTest.validateLoginScreen(LoginTest.java:33)
at com.parsable.cucumber.LoginTest.fullLogin(LoginTest.java:23)
at ✽.Given On “ios”, I have logged in successfully(/Users/garrysidhu/repo/appium-test/features/Garry-WIP.feature:10)

This is the function that i am using:
public void changeMobileDriver(String platform) throws Exception {
quit();
setMobilePlatform(platform);
mobileDriver = getMobileDriver();
sleepSeconds(5);
}