Added check for null in onDestroy of different activities to avoid NullPointerExceptions