Merge "Clean up error handling in createTrack and openRecord"