Properly clean up shader program if exception is thrown.