Waits for gl process to exit first then cleans dupefile (rev.7)

Signed-off-by: nixnodes <code@eth.si>