Take the door trim off; set the catch part of the lock to 'door closed' position and establish exactly what part is making the noise. Go on from there. Always leave another window down to aviod lock outs.
Body computer do smart enough to close windows on lock up.
Good - Fast - Cheap: Pick any two.
E23 735i; E30 318i; E32 735iL (X 2 - 1 White and 1 Light Blue); E34 535i; E38 735iL; R50 Cooper; R55 Cooper Clubman.
E21 318i; E32 735iL; E34 535i; E38 730iL; E53 4.4i