fix(closure): add Closure externs for angular.$q.Promise.finally

Closes #4757
refactor(filterFilter): simplify code by a ternary op instead of if-else

- use only one IIFE and a ternary op in it, instead of invoking separate IIFEs in if-else
(this also completely fixed the same issue closed by PR #3597)
- also add a spec to verify usage of '$' property in expression object (e.g. `{$: 'a'}`)

Closes #5637
Merge branch 'master' of https://github.com/angular/angular.js