Fixed bug that caused incorrect closure captures