fix the try/finally, possibly helping with #674