Add boolean `closeOnSelect` and `closeOnClear` options

Closes #596.