stopBackgroundTask inside an NSTimer in order to let long-running js extra time to complete