Javascript Call Async Function Synchronously