clean up context on build completion & add test

This PR fixes the removal of build context directories from the tmp directory once the build is finished.

It also adds a test to make sure the the context has been properly deleted.