Quasistationary solutions of self-gravitating scalar fields around collapsing stars