Fixed bug in trades closing