Clean out and lubricate the mechanisms, including the lock, to see if that eases the bifold door into closing more efficiently and securely. Spray lubricants that are suitable for your locks onto the lock and use the key to make sure the lubricant is spread to the inside.