* checking if the stop taskHandle is finished before stopping the bg task * stopping the sync in background now works properly * this will prevent the case in which if the app suspends and then is immediately foregrounded again, we do not start the sync * now works as intended * code improvement * improved the code a bit