BlackBerry posts narrow loss on $966 million revenue, improves growth outlook